Tomcat+Nginx+Memcacheed集群部署(4)

[root@server2tomcat]# tail -f logs/catalina.out      #查看日志
Sep28, 2016 11:39:53 PM de.javakaffee.web.msm.serializer.kryo.KryoTranscoder<init>
INFO:Starting with initialBufferSize 102400 and maxBufferSize 2048000
Sep28, 2016 11:39:53 PM de.javakaffee.web.msm.MemcachedSessionServicestartInternal
INFO:MemcachedSessionService finished initialization, sticky true, operation timeout1000, with node ids [n2] and failover node ids [n1]
Sep28, 2016 11:39:53 PM org.apache.coyote.AbstractProtocol start
INFO:Starting ProtocolHandler ["http-bio-8080"]
Sep28, 2016 11:39:53 PM org.apache.coyote.AbstractProtocol start
INFO:Starting ProtocolHandler ["ajp-bio-8009"]
Sep28, 2016 11:39:53 PM org.apache.catalina.startup.Catalina start
INFO:Server startup in 1921 ms
user1= 111
user2= 222
user1= 111          #上面创建的用户
user2= 222
user1= 111
user3= 333
^C
[root@server2tomcat]# telnet 172.25.29.3 11211  #远程登陆服务端3查看是否是否写进入11211是memcached的端口号
Trying172.25.29.3...
Connectedto 172.25.29.3.
Escapecharacter is '^]'.
get50B9BAB1CBB21C9BF884CC3613560752-n2  #get后面的是上面截图里的ID
VALUE50B9BAB1CBB21C9BF884CC3613560752-n2 2048 125
[1]WWqt2Wqt01WqtWqt#50B9BAB1CBB21C9BF884CC3613560752-n2
user2
222user1
111user3
333      #大概可以看出来添加的用户
END
quit
Connectionclosed by foreign host.
 
[root@server2tomcat]# bin/shutdown.sh  #关闭Tomcat1
UsingCATALINA_BASE:  /usr/local/tomcat
UsingCATALINA_HOME:  /usr/local/tomcat
UsingCATALINA_TMPDIR: /usr/local/tomcat/temp
UsingJRE_HOME:        /usr/local/java
UsingCLASSPATH:      /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
 
当关闭Tomcat1续输入数据时并没有中断而是跳到Tomcat2上且数据并未丢失

Tomcat+Nginx+Memcacheed集群部署

[root@server2tomcat]# telnet 172.25.29.3 11211    #远程登陆服务端3
Trying172.25.29.3...
Connectedto 172.25.29.3.
Escapecharacter is '^]'.
get50B9BAB1CBB21C9BF884CC3613560752-n2
VALUE50B9BAB1CBB21C9BF884CC3613560752-n2 2048 137
[1]WWqt2Wqu01WquWqu4#50B9BAB1CBB21C9BF884CC3613560752-n2

--------------------------------------------------------------------------------
user2  222user1  111user4  444user3  333  #大概可以看到数据还是写入服务端3
END
quit
Connectionclosed by foreign host.

更多Tomcat相关教程见以下内容

CentOS 6.6下安装配置Tomcat环境 

RedHat Linux 5.5安装JDK+Tomcat并部署Java项目   

Tomcat权威指南(第二版)(中英高清PDF版+带书签)   

Tomcat 安全配置与性能优化  

Linux下使用Xshell查看Tomcat实时日志中文乱码解决方案  

CentOS 64-bit下安装JDK和Tomcat并设置Tomcat开机启动操作步骤  

CentOS 6.5下安装Tomcat   

Tomcat中session的管理机制 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/33816f087f542c3dfee5042f74b12ab5.html