Setting up a clustered Glassfish is quite easy.
- Review network topology and verify DNS resolution.
- Install Glassfish on the administration node.
- Install Glassfish on each of your cluster nodes.
For testing purposes I have created 1 one administration server, and 3 nodes. I am using the following for DNS resolution.
10.1.1.1 G2-ADMIN
10.1.1.2 G2-NODE1
10.1.1.3 G2-NODE2
10.1.1.4 G2-NODE3
This step is very important! When I was working on this article I had some problems getting it to work properly because I didn't have name resolution setup properly. If you do not have everything setup properly you will experience interesting problems that are quite hard to track.
Install Glassfish on the administration node.The following steps need to be taken on the administration node.
- 1. Download Glassfish JAR file
- 2. Extract Glassfish - java -Xmx256M -jar glassfish-dist.jar
- 3. Setup Glassfish - $GLASSFISH_ROOT/lib/ant/bin/ant -f setup-cluster.xml
- 4. Start Glassfish - $GLASSFISH_ROOT/bin/asadmin start-domain
- 5. Goto http://localhost:4848/ and login
- 6. Create a cluster with name cluster1
The following steps need to be taken on the each of the cluster nodes.
- 1. Download Glassfish JAR file
- 2. Extract Glassfish - java -Xmx256M -jar glassfish-dist.jar
- 3. Setup Glassfish - $GLASSFISH_ROOT/lib/ant/bin/ant -f setup-cluster.xml
- 4. $GLASSFISH_ROOT/bin/asadmin create-node-agent --host G2-ADMIN --port 4848 --user admin cluster1-nodeX-agent
- 5. $GLASSFISH_ROOT/bin/asadmin start-node-agent cluster1-nodeX-agent
Note: nodeX means node1 for G2-NODE1, node2 for G2-NODE2 and node3 for G2-NODE3.
You now have your cluster up and running. The next step is adding instances to your cluster. Go to the administration console of your administration host and create them there. Let me know what you think! Please send comments, suggestions and any feedback to sales@manorrock.com.
(Glassfish 2)