tomcat 集群session共享
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
<Manager className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false"
notifyListenersOnReplication="true"/>
<Channel className="org.apache.catalina.tribes.group.GroupChannel">
<Membership className="org.apache.catalina.tribes.membership.McastService" #定义多播服务
address="228.0.0.4" #多播地址
port="45564" #发送端口
frequency="500" #心跳信息频率
dropTime="3000"/> #心跳信息超时
<Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" #非阻塞复制信息接收心跳
address="auto" #接收网卡ip
port="4000" #接收端口
autoBind="100" #自动绑定
selectorTimeout="5000" #如果有很多回话信息,判断哪个可用的超时时间
maxThreads="6"/>
<Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
<Transport className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
</Sender>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
<Interceptor className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
</Channel>
<Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=""/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>
手动添加多播地址
route add -net 228.101.60.4 netmask 255.255.255.255 dev eth0
app下生成web.xml配置文件
[root@vm2 tomcat8]# cp conf/web.xml webapps/testapp/WEB-INF/web.xml
- Make sure your
web.xmlhas the .<distributable/>element
<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false"/>
默认的tomcat集群支持养殖的部署,即集群可以在其他节点上部署和取消应用程序。该组件是目前的状态在通量,但很快就会得到解决。
有一个变化在部署算法和Tomcat 5.0和5.5之间,这个组件的逻辑改变的地方部署dir必须匹配的webapps目录中。
同步集群下所有节点的一致性。Deployer没试验成功过。。。


浙公网安备 33010602011771号