【server1】
vim /usr/local/lnmp/tomcat/conf/context.xml
<Context>
......
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
memcachedNodes="n1:172.25.45.1:11211,n2:172.25.45.2:11211"
failoverNodes="n1"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
/>
</Context>
【server2】
vim /usr/local/tomcat/conf/context.xml
将failoverNodes的值改为n2
【server1】
cd /usr/local/lnmp/tomcat/lib rm -rf memcached-session-manager-tc6-1.6.3.jar
cd .. bin/shutdown.sh bin/startup.sh tail logs/catalina.out
【server2】
yum install memcached /etc/init.d/memcached start
【server1】
bin/shutdown.sh bin/startup.sh tail logs/catalina.out
【server2】
bin/startup.sh tail logs/catalina.out
yum install telnet
当执行 /etc/init.d/memcached stop 才会改变为n2
避免数据丢失
转载于:https://blog.51cto.com/wjl19940429/1788985