Pages

Tuesday, June 11, 2013

JBoss 7 Clustering : Stand Alone Clustering With Multiple IP address

1.Unzip the JBoss 7 Zip file.
2.make multiple copies of the JBoss 7 as box1 and box2.
3.start one of the stand alone instance from box1 using

[root@vx111a bin]# ./standalone.sh -c standalone-ha.xml -b 172.16.101.235 -u 230.0.0.4 -Djboss.server.base.dir=/soa/copy-eap6/box1 -Djboss.node.name=box1 -Djboss.socket.binding.port-offset=100
Where:
-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)
-Djboss.node.name = 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 -Djava.net.preferIPv4Stack=true -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 [org.jboss.as] (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 [org.jboss.as.server] (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 [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem
17:28:44,955 INFO [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 35) JBAS010260: Activating JGroups subsystem.
17:28:45,174 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
17:28:45,178 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 38) JBAS012605: Activated the following JSF Implementations: [main, 1.2]
17:28:45,179 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem
17:28:45,182 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
17:28:45,541 INFO [org.jboss.as.security] (MSC service thread 1-3) JBAS013170: Current PicketBox version=4.0.17.Final-redhat-1
17:28:46,167 INFO [org.jboss.as.connector.logging] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.17.Final-redhat-1)
17:28:47,029 INFO [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service
17:28:47,034 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
17:28:47,536 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
17:28:47,929 INFO [org.jboss.ws.common.management] (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-/172.16.101.235:8180
17:28:48,802 INFO [org.apache.coyote.http11] (MSC service thread 1-1) JBWEB003000: Coyote HTTP/1.1 starting on: http-/172.16.101.235:8180
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-/172.16.101.235:8109
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 /224.0.1.105:23364
17:28:49,440 INFO [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on 172.16.101.235:4547
17:28:49,442 INFO [org.jboss.as.remoting] (MSC service thread 1-2) JBAS017100: Listening on 127.0.0.1:10099
17:28:49,458 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory /soa/copy-eap6/box1/deployments
17:28:49,757 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
17:28:49,868 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:10090/management
17:28:49,868 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:10090
17:28:49,868 INFO [org.jboss.as] (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)

4.Similarly Start the stand alone server from the second box using a different IP address

[root@vx111a bin]# ./standalone.sh -c standalone-ha.xml -b 172.16.101.196 -u 230.0.0.4 -Djboss.server.base.dir=/soa/copy-eap6/box2 -Djboss.node.name=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 pointing to box2.

The Server gets started normally.

5.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.

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

17:44:36,322 INFO [org.jboss.as.clustering] (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 [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "ClusterWebApp.war" (runtime-name : "ClusterWebApp.war")


And Same can be seen in box1 logs too.

Happy Learning :-)