In the previous part (link) I get you running with a simple Glassfish 3.1 cluster setup with 2 instances running on 2 nodes. Now we have a cluster setup and can deploy an application one time and it will run on both nodes, no big deal, it doesn’t get us anywhere. So in part 2 we will do some modifications to our virtualbox server setup and create a web application with sessions replicated to both instances.
Prerequisites:
- The server and cluster setup from part 1 (link)
Preparation of host and Virtualbox guests:
In part 1 we used n1 and n2 as hostname, this creates trouble for this part. A key information for the sessions is the server-hostname (domain) and we cannot share sessions between totally different hosts.
- Update guest server hostname
Change etc/hosts and /etc/hostname
Server n1 becomes n1.test.com127.0.0.1 localhost 127.0.1.1 n1.test.com 127.0.0.1 n1.test.com 192.168.56.102 n2.test.com
Server n2 becomes n2.test.com
127.0.0.1 localhost 127.0.1.1 n2.test.com 127.0.0.1 n2.test.com 192.168.56.101 n1.test.com
Remarks:
- You can use any domain name (other than test.com, which I dont own btw).
- The IP addresses must fit your own Virtualbox setup.
- Update your host
The host running Virtualbox. Change /etc/hosts192.168.56.101 n1.test.com 192.168.56.102 n2.test.com
- Check multicast
The communication between the nodes is using multicast for the session replication. The Glassfish team gives us a tool to verify if your servers can “see” each other.
Go to the bin folder of the Glassfish installation and execute ./asadmin validate-multicast on both nodes
You should get feedback like this Continue reading
