java - Tomcat Cluster为什么在单机上能够Session同步但是在多机上就不行?
PHPz
PHPz 2017-04-17 13:36:52
0
2
840

特别奇怪的现象!

我用xen开了两个虚拟机,想要让它们之间Session同步。

按照官方的指导教程配置完成之后,Session怎么也不能同步。

但如果只用一个虚拟机上面运行两个Tomcat,打开不同的端口,这种状态下Session就能同步?

我感觉问题发生在跨机器之间数据包没收到。
难道是组播的问题?或者防火墙?不过防火墙我已经彻底关掉了啊。(debian没自带防火墙)

粘一段关于Cluster配置的代码(其实跟官方文档几乎一模一样):

               
PHPz
PHPz

学习是最好的投资!

reply all (2)
黄舟

1. The session is based on the system machine, that is, one machine has one session.
2. There is no problem with a single machine because they are all in the same session.
3. Multiple machines involve session sharing issues. You can Google session sharing issues to find the answer. (Common practice: use a public server for sessions, such as setting up a server and using redis to save sessions)

    黄舟

    Excuse me, has your problem been solved? I also encountered the same problem. Two tomcats on one machine can use cluster to replicate sessions. However, it is not easy to use two machines with the same configuration. Please help!

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!