`
hypercube1024
  • 浏览: 83533 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

配置terracotta高可用集群

    博客分类:
  • java
XML 
阅读更多
由于terracotta肩负着保存session的重任,如果一旦down掉,所有的用户session将会丢失,所以terracotta要做ha。
terracotta集群配置也非常简单
1, 创建一个tc-config.xml文件,如下
<?xml version="1.0" encoding="UTF-8"?>
<!-- All content copyright Terracotta, Inc., unless otherwise indicated.      All rights reserved. -->
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd" 
xmlns:tc="http://www.terracotta.org/config" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  
  <servers>
    <!-- Sets where the Terracotta server can be found. Replace the value of          host with the server's IP address. -->
    <server host="10.192.33.93" name="Server1">
      <data>%(user.home)/terracotta/server-data</data>
      <logs>%(user.home)/terracotta/server-logs</logs>
    </server>
    <!-- If using a standby Terracotta server, also referred to as an ACTIVE-PASSIVE configuration, add the second server here. -->
    <server host="10.192.33.94" name="Server2">
      <data>%(user.home)/terracotta/server-data</data>
      <logs>%(user.home)/terracotta/server-logs</logs>
    </server>
	
	<server host="192.168.1.100" name="Server3">
      <data>%(user.home)/terracotta/server-data</data>
      <logs>%(user.home)/terracotta/server-logs</logs>
    </server>
	
	<server host="192.168.1.101" name="Server4">
      <data>%(user.home)/terracotta/server-data</data>
      <logs>%(user.home)/terracotta/server-logs</logs>
    </server>
<!-- If using more than one server, add an <ha> section. -->
    <ha>
       <mode>networked-active-passive</mode>
       <networked-active-passive>
               <election-time>5</election-time>
       </networked-active-passive>
    </ha>
  </servers>
  <!-- Sets where the generated client logs are saved on clients. -->  
  <clients>
    <logs>%(user.home)/terracotta/client-logs</logs>
  </clients>
</tc:tc-config>


2,加载配置文件,运行命令tim-get.sh upgrade <tc-config.xml-path>/tc-config.xml
3,启动TCserver需要增加 -n 参数
./start-tc-server.sh -n Server2 &
分享到:
评论
3 楼 j2ee_yohn 2012-12-26  
如果是多台机器如何做集群。我的配置都没有成功。单台机器是成功的。谢谢
2 楼 hypercube1024 2011-04-18  
watson243671 写道
请问它和maven2合并怎么用?maven+jetty+terracotta可以么?

可以配置
1 楼 watson243671 2011-04-16  
请问它和maven2合并怎么用?maven+jetty+terracotta可以么?

相关推荐

Global site tag (gtag.js) - Google Analytics