Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Implementation Scheme of session sharing in tomcat8

Shulou Source: shulou.com Published: 2022-06-03 03:21:47 11月10日 Update

Session sharing implementation of tomcat8 downloading tomcat

Version: apache-tomcat-8.0.53.zip

To implement the steps, you only need to add the same server.xml for both tomcat and cluster to configure the web.xml for both tomcat applications.

For example, in:

/ Users/da/Library/Tomcat/apache-tomcat-8.0.53-8081/webapps/ROOT/WEB-INF/web.xml

Add:

Then restart the two tomcat to create a new jsp test

Session.jsp

Test2 SessionID is

SessionIP is

SessionPort is

For example, put it on:

/ Users/da/Library/Tomcat/apache-tomcat-8.0.53-8082/webapps/ROOT/session.jsp

The other one is the same.

Visit:

Http://localhost:8081/session.jsp

Http://localhost:8082/session.jsp

Sessionid consistent:

SessionID is 6E5D26E07FDE6FB5D01A59F457D64333 SessionIP is tomcat.chinaunicom.tech SessionPort is 80 Response from tomcat1SessionID is 6E5D26E07FDE6FB5D01A59F457D64333 SessionIP is tomcat.chinaunicom.tech SessionPort is 80 Response from tomcat2 considerations require the tomcat8 version (the above test passed on 8.0.53). If you need tomcat7, please tell me that it is not this kind of configuration. I need to modify the configuration of distributable and do not miss the configuration of session. This scheme is only suitable for applications with less concurrency. For now, we can use it first. Tomorrow I will try a more complex scheme with large concurrency to see if it works.

Refer to the official website:

Http://localhost:8082/docs/cluster-howto.html

Http://tomcat.apache.org/tomcat-8.0-doc/config/cluster.html

Translation:

Http://wiki.jikexueyuan.com/project/tomcat/clustering.html

Tags: Configuration scheme two version application test no complex consistent matters steps precautions first use reference try Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Shulou Tech Info NVidia Apple