Session replication in Glassfish Cluster on EC2

2019-05-25 06:00发布

问题:

I've built a cluster on Glassfish administred via SSH, where there are 2 instances. I deployed an application that shows the "Session id".

This application has in the web.config:

<distributable/>

And in the sun-web.xml:

<session-config>
    <cookie-properties>
         <property name="cookieDomain" value="compute.amazonaws.com"/>
    </cookie-properties>
</session-config>

I enabled "Availability" in Edit Application.

But when I access the 2 web app versions I see different session ids. Can anyone help me?

EDIT: As some users noticed, in EC2 is not supported multicast. A solution comes with Glassfish v3.1.2, that allows two other different ways to discover a cluster when multicasting is not permitted (by listing instances ip or making it auto-generate the list). Here's specified how to start a cluster in a non-multicasting environment: Administering Glassfish Server Clusters

回答1:

Read the High Availability Administration Guide for v3.1.2, specifically section "Discovering a Cluster When Multicast Transport Is Unavailable". Haven't tried it yet, but looking forward. Cheers!



回答2:

First thing to try would be trying to validate if the multicast works on your your setup, use below asadmin command.

asadmin validate-multicast       

You can checkout this simple Youtube Video about how to do that

http://www.youtube.com/watch?v=sJTDao9OpWA

In case Multicast does not work, you may want to try the non multicast option that is supported on Recent release of Glassfish 3.1.2

The release notes say that it supports non multicast clustering

New Support for non-Multicast clustering. GlassFish High-Availability clustering is now possible in environments where multicast is disabled.

I was not able to find any documentation that provides steps for setting up the non Multicast cluster. There may be one for the enterprise support customers.



回答3:

As some users noticed, in EC2 is not supported multicast. A solution comes with Glassfish v3.1.2, that allows two other different ways to discover a cluster when multicasting is not permitted (by listing instances ip or making it auto-generate the list). Here's specified how to start a cluster in a non-multicasting environment: Administering Glassfish Server Clusters