Creating and Configuring Glassfish Cluster with MQ Cluster

1. Install Glassfish with cluster profile:

a. Make sure ANT_HOME environment variable points to the ant instation folder. For example: “C:Program Filesapache-ant-1.7.1”

b. Make sure PATH variable has ant’s bin folder. For example: “C:Program Filesapache-ant-1.7.1bin”

c. Go to the folder where glassfish jar (glassfish-installer-v2.1.1-b31g-windows.jar) is extracted.

d. Run: “ant –f setup-cluster.xml”. You should see “Build Successful” message.

e. Follow the installation on all the systems where Glassfish needs to be installed

2. Start glassfish domain.

a. Choose one of the Glassfish installation server as Domain Administration Server (DAS). The domain administration server is used to administer all the servers in the cluster.

b. Start the Domain Administration server. Go to glassfishbin folder and Run: “asadmin start-domain domain1”

3. Create Node agents

a. Node agents need to be created on each system where we need a Glassfish cluster instance.

b. Go to DAS admin console.

c. Navigate to Node Agents on left hand tree

d. Click “New” for creating node agents.

e. Give a node agent name. Click Ok

f. We need to run “asadmin create-node-agent” command on all the host machines which will participate in this cluster. For now, Click Ok.

g. Follow the above steps to create node agents for each machine.

h. The screen should look like this:

i. Go to a system which will participate in the cluster. Open command prompt and change directory to <GlassFishDir>/glassfish/bin.

j. Run “asadmin create-node-agent –host <host or IP> –port 4848 <node-agent-name>”. The node-agent-name should be exactly same as what we gave in admin console. The host or IP is DAS host / IP. If the system is not able to reach DAS host, the above screen will say “Waiting for rendezvous”.

k. Follow the above step to create node agent in each system which will participate in cluster.

l. After the node agents creation and if the systems are reachable, refresh the above screen. The screen should look like this:

m. Start the node agents. Run “asadmin start-node-agent –syncinstances=true <node-agent-name>” in all the systems where node agents are created.

n. Refresh the Node agents screen. The status of the node agents should say “Running”

4. Creating Cluster.

a. Navigate to Clusters on left hand tree.

b. Click on New. Give a Cluster name

c. For each server instance to be created. Click on New under “Server Instances to be Created”.

d. Select the node-agent where we need the instance to be created.

e. Click Ok.

f. Once they are created, the instance status will say “Stopped”

g. Start the cluster by selecting the checkbox next to cluster and clicking on Start Cluster.

Note: When I started the cluster I got an error saying that “instance-2 does not exist. Please check node agent’s log”. After troubleshooting I found that the DAS and the host where instance-2 is running were not able to communicate with each other. I edited etc/hosts file on both sides to include the IP address with host name. This will help in resolving hostnames to IP.

MQ Clusters

The MQ clusters are created by default when a server cluster is created. By default, there will be one MQ broker per server instance.

To test MQ Cluster step:

1. Navigate to Clusters-> Cluster1 -> instance-1 on left hand tree. Click on Properties tab on right hand screen. This screen shows the various port numbers which are automatically configured.

2. When an instance is running, MQ Broker must also be running. To test if it is running, use Qbrowser to connect by providing the host name and port.

3. The above method is for testing if an MQ broker is running. To test if they are clustered:

a. Connect to one of the MQ Brokers from QBrowser.

b. Right click on Queue and Click Create Queue

c. Give the Queue name as “MyQueue”.

d. Now connect to the another MQ broker in the cluster using Qbrowser. You can notice that “MyQueue” is created in the second MQ Broker also.

Submit a Comment