Tuesday, June 11, 2013

JBoss 7 Clustering : Stand Alone Clustering With Single IP address

In this series of articles , we will see how we can configure A Cluster in JBoss 7.In the first series we will see how we can configure a Cluster in Single IP machine using the Stand alone mode.

Stand Alone Clustering With Single IP address

1.Unzip the JBoss 7 Zip file.
2.make multiple copies of the Stand alone Directory in the same Location besides stand alone and Domain directories as box1 and box2.

3.Go to /bin location and start the Stand alone instances.

4.start one of the stand alone instance from box1 using

[root@vx111a bin]# ./ -c standalone-ha.xml -b -u -Djboss.server.base.dir=/soa/copy-eap6/box1 -Djboss.socket.binding.port-offset=100

-c = is for server configuration file to be used
-b = is for binding address ( My IP address)
-Djboss.server.base.dir = is for the path from where node is present (Location of Box1) = is for the name of the node ( Name of the Node = box1)
-Djboss.socket.binding.port-offset = is for the port offset on which node would be running

Both the nodes should have unique node names
Both the nodes should have unique socket binding port-offsets as they are running on the same box

Once you start the box1 ,

JBoss Bootstrap Environment

JBOSS_HOME: /soa/copy-eap6

JAVA: /usr/jdk1.6.0_14/bin/java

JAVA_OPTS: -server -Xms1303m -Xmx1303m -XX:MaxPermSize=256m -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true


17:28:39,335 INFO [org.jboss.modules] (main) JBoss Modules version 1.2.0.Final-redhat-1
17:28:39,643 INFO [org.jboss.msc] (main) JBoss MSC version 1.0.4.GA-redhat-1
17:28:39,816 INFO [] (MSC service thread 1-4) JBAS015899: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) starting
17:28:44,716 INFO [org.xnio] (MSC service thread 1-3) XNIO Version 3.0.7.GA-redhat-1
17:28:44,736 INFO [org.xnio.nio] (MSC service thread 1-3) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
17:28:44,781 INFO [] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
17:28:44,785 INFO [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 3.2.16.GA-redhat-1
17:28:44,950 INFO [] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem
17:28:44,955 INFO [] (ServerService Thread Pool -- 35) JBAS010260: Activating JGroups subsystem.
17:28:45,174 INFO [] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
17:28:45,178 INFO [] (ServerService Thread Pool -- 38) JBAS012605: Activated the following JSF Implementations: [main, 1.2]
17:28:45,179 INFO [] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem
17:28:45,182 INFO [] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
17:28:45,541 INFO [] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.17.Final-redhat-1
17:28:46,167 INFO [] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.17.Final-redhat-1)
17:28:47,029 INFO [] (MSC service thread 1-3) JBAS011802: Starting Naming Service
17:28:47,034 INFO [] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
17:28:47,536 INFO [] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
17:28:47,929 INFO [] (MSC service thread 1-2) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.1.3.Final-redhat-3
17:28:48,630 INFO [org.apache.coyote.http11] (MSC service thread 1-1) JBWEB003001: Coyote HTTP/1.1 initializing on : http-/
17:28:48,802 INFO [org.apache.coyote.http11] (MSC service thread 1-1) JBWEB003000: Coyote HTTP/1.1 starting on: http-/
17:28:48,887 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 31) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
17:28:48,968 INFO [org.apache.coyote.ajp] (MSC service thread 1-1) JBWEB003046: Starting Coyote AJP/1.3 on ajp-/
17:28:48,988 INFO [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 31) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be passivated.
17:28:49,130 INFO [org.jboss.modcluster] (ServerService Thread Pool -- 52) MODCLUSTER000001: Initializing mod_cluster ${project.version}
17:28:49,138 INFO [org.jboss.modcluster] (ServerService Thread Pool -- 52) MODCLUSTER000032: Listening to proxy advertisements on /
17:28:49,440 INFO [] (MSC service thread 1-4) JBAS017100: Listening on
17:28:49,442 INFO [] (MSC service thread 1-2) JBAS017100: Listening on
17:28:49,458 INFO [] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /soa/copy-eap6/box1/deployments
17:28:49,757 INFO [] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
17:28:49,868 INFO [] (Controller Boot Thread) JBAS015961: Http management interface listening on
17:28:49,868 INFO [] (Controller Boot Thread) JBAS015951: Admin console listening on
17:28:49,868 INFO [] (Controller Boot Thread) JBAS015874: JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) started in 11031ms - Started 125 of 238 services (112 services are passive or on-demand)

5.Similarly Start the stand alone server from the second box using

[root@vx111a bin]# ./ -c standalone-ha.xml -b -u -Djboss.server.base.dir=/soa/copy-eap6/box2 -Djboss.socket.binding.port-offset=200

The Socket Binding were Changed to 200 and node name was given as box2 .The Server location was also poing to box2.

The Server gets started normally.

6.Now if we need to make sure whether these are configured as cluster ,we need to deploy a application where there is a <distributable/> tag available in web.xml file.

7.Once you deploy the application , you can see the logs as

17:44:36,322 INFO [] (MSC service thread 1-1) JBAS010238: Number of cluster members: 2
17:44:36,332 INFO [org.jboss.web] (ServerService Thread Pool -- 53) JBAS018210: Register web context: /ClusterWebApp
17:44:36,550 INFO [] (DeploymentScanner-threads - 1) JBAS018559: Deployed "ClusterWebApp.war" (runtime-name : "ClusterWebApp.war")

And Same can be seen in box1 logs too.

Happy Learning :-)