Document Version 1.0
Copyright © 2012-2013 beijing.beijing.012@gmail.com
Keywords:
JBoss 7 HA Service, HA Singleton, JBoss 7 Cluster, load migration, load distribution, HA Service deployment
Start 2 standalone JBosss 7 server in clustered mode [Draft]
Download JBoss AS 7.1.1.Final and extract the archive to a tmp location, lets say " JBoss_AS_7_1_1_Final"
Create 2 new folders:
jboss7_node1
jboss7_node2
Copy all folders and files under "JBoss_AS_7_1_1_Final" into jboss7_node1.
Copy all folders and files under "JBoss_AS_7_1_1_Final" into jboss7_node2.
Now we have 2 JBoss nodes ready to be started.
Start "jboss7_node1" in clusted mode using command:
./standalone.sh -Djboss.node.name=node1 --server-config=standalone-ha.xml
The node1 is started correctly in clusted mode when following line is shown in console:
[org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl] (MSC service thread 1-3) Listening to proxy advertisements on 224.0.1.105:23364
....
When you are familiar with older JBoss (4x, 5x version), you may expect to see log info about cluster information or node information. But JBoss 7 will not show such info yet.
Start "jboss7_node2" in clusted mode using command:
./standalone.sh -Djboss.node.name=node2 --server-config=standalone-ha.xml -Djboss.socket.binding.port-offset=100
The node2 is started correctly in clustered mode when following line is shown in console:
[org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl] (MSC service thread 1-3) Listening to proxy advertisements on 224.0.1.105:23364
....
Here we still can not see any log info to clusters and nodes.
You could just write a samll "Hello World" web applicaiton and try to deploy it in cluster.
I will just take the "TestWebSec20" web application, add "<distributable/>" to the web.xml file and try put the "TestWebSec20.war" into the folder "deployments" of jboss7_node1.
The console of node1 shows:
21:19:36,185 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.web] (MSC service thread 1-1) JBAS010206: Number of cluster members: 1
....
21:19:37,378 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "TestWebSec20.war"
Now cluster info is shown, but where is the node2?
Now try to deploy the "TestWebSec20.wa" in node2, put the war file in the folder "deployments" of jboss7_node2.
The console of node2 shows:
21:26:35,227 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.web] (MSC service thread 1-3) JBAS010206: Number of cluster members: 2
....
21:26:37,207 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "TestWebSec20.war"
Lets take look again the console of node1:
21:26:31,272 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.lifecycle.web] (Incoming-1,null) JBAS010247: New cluster view for partition web (id: 1, delta: 1, merge: false) :
[node1/web, node2/web]
You could just write a samll "Hello World" web applicaiton and try to deploy it in cluster.
I will just take the "TestWebSec20" web application, add "<distributable/>" to the web.xml file and try put the "TestWebSec20.war" into the folder "deployments" of jboss7_node1.
The console of node1 shows:
21:19:36,185 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.web] (MSC service thread 1-1) JBAS010206: Number of cluster members: 1
....
21:19:37,378 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "TestWebSec20.war"
Now cluster info is shown, but where is the node2?
Now try to deploy the "TestWebSec20.wa" in node2, put the war file in the folder "deployments" of jboss7_node2.
The console of node2 shows:
21:26:35,227 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.web] (MSC service thread 1-3) JBAS010206: Number of cluster members: 2
....
21:26:37,207 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "TestWebSec20.war"
Lets take look again the console of node1:
21:26:31,272 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.lifecycle.web] (Incoming-1,null) JBAS010247: New cluster view for partition web (id: 1, delta: 1, merge: false) :
[node1/web, node2/web]
21:26:31,326 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-1,null) ISPN000094: Received new cluster view: [node1/web|1] [node1/web, node2/web]
Now lets shutdown node1, and console of node2 shows:
21:31:10,903 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.lifecycle.web] (Incoming-6,null) JBAS010247: New cluster view for partition web (id: 2, delta: -1, merge: false) : [node2/web]
21:31:10,961 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (Incoming-6,null) ISPN000094: Received new cluster view: [node2/web|2] [node2/web]
No comments:
Post a Comment