环境:

centos 6.6

java version:1.6.0.38

tomcat version:6.0.39

terracotta version:3.7.5

terracotta 3.7.5下载地址:

360下载地址:  访问密码 66bd

官网下载地址:

注:terracotta节点两边的tc-config.xml需要完全相同

start-tc-server.sh需要添加JAVA_HOME环境变量

Question:

1、所有tomcat节点只能在一个服务器上,其他服务器上的tomcat将不能加入到terracotta,启动tomcat还报错,原因未知

2、本地测试没问题,但是放入代码后,出现每2分钟弹出登录的情况,原因未知


terracotta需要监听三个端口:

9510:监听客户端连接的端口

9520:监听Terracotta Developer Console连接的端口

9530:Terracotta之间通信的端口

Node1:

[root@localhost ~]# tar -zxf terracotta-3.7.5.tar.gz -C /usr/local/[root@localhost ~]# cd /usr/local/terracotta-3.7.5/[root@localhost terracotta-3.7.5]# cp config-samples/tc-config-express-reference.xml config-samples/tc-config.xml[root@localhost terracotta-3.7.5]# cp sessions/terracotta-session-1.3.5.jar common/terracotta-toolkit-1.6-runtime-5.5.0.jar /usr/local/server/tomcat1/lib/[root@localhost terracotta-3.7.5]# cp sessions/terracotta-session-1.3.5.jar common/terracotta-toolkit-1.6-runtime-5.5.0.jar /usr/local/server/tomcat2/lib/[root@localhost ~]# grep -i 'terracotta' /usr/local/server/tomcat1/conf/context.xml
[root@localhost ~]# grep -i 'terracotta' /usr/local/server/tomcat2/conf/context.xml
[root@localhost ~]#
[root@localhost ~]# touch /opt/terracotta/realm.properties[root@localhost ~]# /usr/local/terracotta-3.7.5/bin/start-tc-server.sh -f /usr/local/terracotta-3.7.5/config-samples/tc-config.xml -n Server1 &[root@localhost ~]# ps -ef |grep terracotta | grep -v greproot      1800  1223  0 17:11 pts/0    00:00:00 /bin/sh /usr/local/terracotta-3.7.5/bin/start-tc-server.sh -f /usr/local/terracotta-3.7.5/config-samples/tc-config.xmlroot      1813  1800  6 17:11 pts/0    00:00:12 /usr/local/jdk1.6.0_38/bin/java -server -XX:MaxDirectMemorySize=9223372036854775807 -Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dtc.install-root=/usr/local/terracotta-3.7.5/bin/.. -Dsun.rmi.dgc.server.gcInterval=31536000000 -cp /usr/local/terracotta-3.7.5/bin/../lib/tc.jar com.tc.server.TCServerMain -f /usr/local/terracotta-3.7.5/config-samples/tc-config.xml[root@localhost ~]#

Node2:

[root@localhost ~]# tar -zxf terracotta-3.7.5.tar.gz -C /usr/local/[root@localhost ~]# cd /usr/local/terracotta-3.7.5/[root@localhost terracotta-3.7.5]# cp config-samples/tc-config-express-reference.xml config-samples/tc-config.xml[root@localhost ~]# /usr/local/terracotta-3.7.5/bin/start-tc-server.sh -f /usr/local/terracotta-3.7.5/config-samples/tc-config.xml -n Server2 &

[root@localhost ~]# /usr/local/server/tomcat1/bin/startup.sh[root@localhost ~]# /usr/local/server/tomcat2/bin/startup.sh[root@localhost ~]# /etc/init.d/nginx start

打开Terracotta开发工具dev-consol(注:Linux服务器需要安装图形化界面)

[root@localhost ~]# /usr/local/terracotta-3.7.5/bin/dev-console.sh

以上是安装方法。

 

注:在本地测试环境测试时没有任何问题,当部署上线后,还是会出现session问题,唉~