Glassfish cluster

Setting up a clustered Glassfish is quite easy.

  1. Review network topology and verify DNS resolution.
  2. Install Glassfish on the administration node.
  3. Install Glassfish on each of your cluster nodes.

Review network topology and verify DNS resolution

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
  7. Install Glassfish on the cluster nodes.

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!

(Glassfish 2)

Posted September 14, 2012

Up