Pages

Tuesday, June 18, 2013

Cluster Configuration in JBoss 7

The Configuration of Cluster in JBoss 7 is very Easy.

Here are the Sequence of steps to follow to configure a Cluster in JBoss 7
  1. Configure JBoss Servers in Domain Mode. Follow the steps in this link as Usual.
  2. Once you are done with Running JBoss Server in Domain Mode. Now we need to configure another Server on the “Host1” adding that new JBoss Server to “ha-server-group”
  3. Now Configure a new Server in host like
<server name="ha-server-1" group="ha-server-group" auto-start="true">
<socket-bindings port-offset="300"/>
</server>

on the HC side

4.Once you configure these , Start DC using

./domain.sh -b 172.16.101.235 -bmanagement 172.16.101.235

and start the HC Using

./domain.sh -Djboss.domain.master.address=172.16.101.235 -b 172.16.101.196 -bmanagement 172.16.101.196

5.Now from the Management Console , you can see




and also on the Host Screen you can see

















We can see the ha-server-2 configured on host1.

6.The next step is to deploy a application ,

Click On the “Manage Deployments” on the Right side
Click On the “Add” on the Left Side
Browse the File and select Ok for deployment.
Once the application is deployed , we need to enable the application.

Once the application is enabled , we need to assign it the server-group like

Select the Server-group(ha-Server-group).Select the Group Deployment.
The above screen will appear. Select the “assign” button to select the application.
Select the application and click Assign to assign the application to the Server -group.
Once it is assigned , enable the application on the server-group. At this point you can see the logs filling like

on HC Side

[Server:ha-server-2] 18:49:51,515 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 53) JBAS010281: Started repl cache from web container
[Server:ha-server-2] 18:49:51,518 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 54) JBAS010281: Started default-host/ClusterWebApp cache from web container
[Server:ha-server-2] 18:49:51,575 INFO [org.jboss.as.clustering] (MSC service thread 1-3) JBAS010238: Number of cluster members: 2
[Server:ha-server-2] 18:49:51,590 INFO [org.jboss.web] (ServerService Thread Pool -- 53) JBAS018210: Register web context: /ClusterWebApp
[Server:ha-server-2] 18:49:51,851 INFO [org.jboss.as.server] (host-controller-connection-threads - 3) JBAS018559: Deployed "ClusterWebApp.war" (runtime-name : "ClusterWebApp.war")

on DC Side

[Server:ha-server-1] 18:49:50,659 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 53) JBAS010281: Started repl cache from web container
[Server:ha-server-1] 18:49:50,717 INFO [org.jboss.as.clustering] (MSC service thread 1-4) JBAS010238: Number of cluster members: 1
[Server:ha-server-1] 18:49:50,736 INFO [org.jboss.web] (ServerService Thread Pool -- 55) JBAS018210: Register web context: /ClusterWebApp
[Server:ha-server-1] 18:49:50,910 INFO [org.jboss.as.clustering] (Incoming-1,shared=udp) JBAS010225: New cluster view for partition web (id: 1, delta: 1, merge: false) : [masterOne:ha-server-1/web, host1:ha-server-2/web]
[Server:ha-server-1] 18:49:50,913 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-1,shared=udp) ISPN000094: Received new cluster view: [masterOne:ha-server-1/web|1] [masterOne:ha-server-1/web, host1:ha-server-2/web]
[Server:ha-server-1] 18:49:51,848 INFO [org.jboss.as.server] (host-controller-connection-threads - 3) JBAS018559: Deployed "ClusterWebApp.war" (runtime-name : "ClusterWebApp.war")

We can see the application is deployed in a Clustered Environment. Happy learning :-)