Reputation: 2496
I believe I am missing some configuration either on load balancing side or in tomcat, it would great if someone could help and provide the solution.
What am i trying to do?
I did refer to this issue which refers setting up hazelcast.sessionId instead of JSESSIONID but does not provide any specifics about how to.
Versions -
Apache Haus - 2.2.32 (for load balancing)
Hazelcast - 3.8.6
Java 8
Tomcat - 6.0.48
Session objects that need to be clustered are Serializable.
stickysession=JSESSIONID
Load Balancer Configuration
<Proxy balancer://mycluster>
BalancerMember http://IPAddress1:8080/app/ route=tom
BalancerMember http://IPAddress2:8080/app/ route=cat
ProxySet lbmethod=byrequests stickysession=JSESSIONID|jsessionid
</Proxy>
ProxyPass /app/ balancer://mycluster/
ProxyPassReverse /app/ balancer://mycluster/
tom instance - server.xml
<Listener className="com.hazelcast.session.P2PLifecycleListener"/>
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tom">
tom instance - context.xml
<Manager className="com.hazelcast.session.HazelcastSessionManager" sticky=true/>
cat instance - server.xml
<Listener className="com.hazelcast.session.P2PLifecycleListener"/>
<Engine name="Catalina" defaultHost="localhost" jvmRoute="cat">
cat instance - context.xml
<Manager className="com.hazelcast.session.HazelcastSessionManager" sticky=true/>
Update:
I believe the below is the same issue I have session sync failure
Upvotes: 0
Views: 726
Reputation: 2496
I got it working with the below configuration. Figured it needed both jsessionid and hazelcast.sessionid, the session replication works great now.
<Proxy balancer://mycluster>
BalancerMember http://IPAddress1:8080/app/ route=tom
BalancerMember http://IPAddress2:8080/app/ route=cat
ProxySet lbmethod=byrequests stickysession=JSESSIONID|jsessionid|hazelcast.sessionId
</Proxy>
ProxyPass /app/ balancer://mycluster/
ProxyPassReverse /app/ balancer://mycluster/
Upvotes: 0
Reputation: 677
Although I don't have much experience of using Apache HTTP server as a load balancer, looking at this page, I think you need to update your load balancer configuration as follows:
<Proxy balancer://mycluster>
BalancerMember http://IPAddress1:8080/app/ route=tom
BalancerMember http://IPAddress2:8080/app/ route=cat
ProxySet lbmethod=byrequests stickysession=hazelcast.sessionId
</Proxy>
ProxyPass /app/ balancer://mycluster/
ProxyPassReverse /app/ balancer://mycluster/
Do we have a client where I could monitor hazelcast sessions?
You can use Hazelcast Management Center to monitor the cluster and browse the session entries that are stored in the Hazelcast IMap. All sessions are stored in a Hazelcast IMap keyed by their IDs. Please note that you need to enable Management Center on the members of your cluster before being able to see any data on Management Center.
You can also have a look into the Docker code samples for container based session replication to see a working configuration of session replication. Although there's none that uses Apache as a load balancer, there's one that uses Nginx which might be of help to you.
Upvotes: 1