7oi76i 发表于 2016-7-12 09:09:34

部署terracotta集群存储tomcat的session

环境:
centos 6.6

java version:1.6.0.38
tomcat version:6.0.39
terracotta version:3.7.5

terracotta 3.7.5下载地址:

360下载地址:https://yunpan.cn/cBjGjarCiynLi访问密码 66bd
官网下载地址:http://terracotta.org/downloads/open-source/destination?name=terracotta-3.7.5.tar.gz&bucket=tcdistributions&file=terracotta-3.7.5.tar.gz

注: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:

1
2
3
4
5
6
7
8
9
10
# tar -zxf terracotta-3.7.5.tar.gz -C /usr/local/
# cd /usr/local/terracotta-3.7.5/
# cp config-samples/tc-config-express-reference.xml config-samples/tc-config.xml
# cp sessions/terracotta-session-1.3.5.jar common/terracotta-toolkit-1.6-runtime-5.5.0.jar /usr/local/server/tomcat1/lib/
# cp sessions/terracotta-session-1.3.5.jar common/terracotta-toolkit-1.6-runtime-5.5.0.jar /usr/local/server/tomcat2/lib/
# grep -i 'terracotta' /usr/local/server/tomcat1/conf/context.xml
<Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="192.168.31.160:9510,192.168.31.170:9510"/>
# grep -i 'terracotta' /usr/local/server/tomcat2/conf/context.xml
<Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="192.168.31.160:9510,192.168.31.170:9510"/>
#





1
2
3
4
5
6
# touch /opt/terracotta/realm.properties
# /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 &
# ps -ef |grep terracotta | grep -v grep
root      180012230 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.xml
root      181318006 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
#





Node2:

1
2
3
4
# tar -zxf terracotta-3.7.5.tar.gz -C /usr/local/
# cd /usr/local/terracotta-3.7.5/
# cp config-samples/tc-config-express-reference.xml config-samples/tc-config.xml
# /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 &








1
2
3
# /usr/local/server/tomcat1/bin/startup.sh
# /usr/local/server/tomcat2/bin/startup.sh
# /etc/init.d/nginx start









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

1
# /usr/local/terracotta-3.7.5/bin/dev-console.sh








以上是安装方法。


页: [1]
查看完整版本: 部署terracotta集群存储tomcat的session