Enabling sticky session mode for load balancing Apache / Tomcat

I am trying to enable sticky sessions in Apache, however it does not work. Below are the changes made by me. Can someone ask for advice if I missed something?

I do not see errors in the access log, however, a request from one user still goes to another server. Please let me know if any further information is needed to answer / help my request.

Step 1 : added below in httpd.conf load balancing server1 and server2

<Proxy balancer://marsBalancer>
BalancerMember http://server1fullname:8080  route=server1 
BalancerMember http://server2fullname:8080  route=server2
ProxySet lbmethod=bytraffic
ProxySet stickysession=JSESSIONID
</Proxy>
ProxyPass /marsWAR/ balancer://marsBalancer/marsWAR/

Step 2 : updated below in server.xml

a) server.xml in server1

<Engine name="Catalina" defaultHost="localhost" jvmRoute="server1">    

b) server.xml in server2

<Engine name="Catalina" defaultHost="localhost" jvmRoute="server2">
+4
2

marsWAR ProxyPass:

ProxyPass /marsWAR/ balancer://marsBalancer/

, <id> ProxyPass, :

ProxyPass /marsWAR/ balancer://marsBalancer/ stickysession=JSESSIONID
+3
  • =?
  • stickysession=JSESSIONID|jsessionid, cookie , . scolonpathdelim=On [1] . " " .

[1] http://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html#stickyness_implementation

+2

Source: https://habr.com/ru/post/1616027/


All Articles