-
1. Re: How to achieve session replication among jboss clusters in jboss As 7.1
chaitu1011 May 29, 2012 7:19 AM (in response to chaitu1011)any one guys ??
any infomation is highly appreciated.
thanks
-
2. Re: How to achieve session replication among jboss clusters in jboss As 7.1
rhusar May 29, 2012 7:28 AM (in response to chaitu1011)1 of 1 people found this helpfulI have made two standalone jboss 7 instances, and am able to load balance them using mod_jk.
Just make sure you are running standalone-ha.xml or standalone-full-ha.xml profiles that include clustering.
Also make sure that you have sticky sessions on, and stick sessions force off.
Check the log that the logs show that multiple nodes joined in.
i have searched the internet and found that adding <distributable/> tag to the web.xml would enable the session replication.
Yes that is enough. But you need to make sure that after each change to the session you call on HttpSession.setAttribute(xyz) to tell clustering that the attribute has changed and should replicate.
Rado
-
3. Re: How to achieve session replication among jboss clusters in jboss As 7.1
chaitu1011 May 29, 2012 7:53 AM (in response to rhusar)Hi Rado
Thanks a lot for your reply,
so if i run jboss with standalone-ha.xml, dont i need to create multiple instances of jboss ??
could be please elaborate on that ?
and alo i have sticky session = true in my workers.properties file .
Thanks
-
4. Re: How to achieve session replication among jboss clusters in jboss As 7.1
rhusar May 29, 2012 9:06 AM (in response to chaitu1011)so if i run jboss with standalone-ha.xml, dont i need to create multiple instances of jboss ??
Well, if you want reasonable clustering you always need at least 2 nodes, right? ;-) So on each machine you need to unzip and start separately. So yes, you create multiple instances.
Make sure you bind (-b switch) to "public" IP addresses, meaning the instances can see each other and communicate.
and alo i have sticky session = true in my workers.properties file .
Yap, that's good when your application is stateful.
Rado
-
5. Re: How to achieve session replication among jboss clusters in jboss As 7.1
chaitu1011 May 29, 2012 9:58 AM (in response to rhusar)Hi Rado,
Thanks, i have configured the changes as you said. but still unable to acheive session replication .
I am using mod_jk for load balancing by the way.
below is my worker.properties file
# Define list of workers that will be used
# for mapping requests
worker.list= loadbalancer,status,node1,node2
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=127.0.0.1
worker.node1.type=ajp13
worker.node1.lbfactor=1
#worker.node1.prepost_timeout=10000
#worker.node1.connect_timeout=10000
worker.node1.connection_pool_size=10
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8010
worker.node2.host=192.168.16.228
worker.node2.type=ajp13
worker.node2.lbfactor=1
#worker.node2.prepost_timeout=10000
#worker.node2.connect_timeout=10000
worker.node2.connection_pool_size=10
# Load-balancing behaviour
worker.loadbalancer.balance_workers=node1,node2
worker.loadbalancer.type=lb
worker.loadbalancer.sticky_session=force
sticky-session-force=false
# Status worker for managing load balancer
worker.status.type=status
and things i have configured in standalone-ha.xml
xml1
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false" instance-id="node1">
xml2
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false" instance-id="node2">
i can see in the logs that the clustering is happeneing.
please let me know if i am missing any configarations
Thanks a ton for your help ..
-
6. Re: How to achieve session replication among jboss clusters in jboss As 7.1
chaitu1011 May 30, 2012 7:49 AM (in response to chaitu1011)any one guys ...
-
7. Re: How to achieve session replication among jboss clusters in jboss As 7.1
rhusar May 30, 2012 8:07 AM (in response to chaitu1011)Does that configuration even work?
worker.list= loadbalancer,status,node1,node2
should be
worker.list=loadbalancer,status
worker.node2.port=8010
Doing port offset like this is not very good. Bind to different IP adresses (different like 10.0.0.1 and 10.0.0.2) and dont use port offset.
worker.node2.connection_pool_size=10
You can leave the default value here IMHO, so you dont have to specify it.
worker.loadbalancer.sticky_session=force
AFAIR it should be worker.loadbalancer.sticky_session=True
The instance-id are correct.
-
8. Re: How to achieve session replication among jboss clusters in jboss As 7.1
chaitu1011 May 30, 2012 9:30 AM (in response to rhusar)Hi Rado,
Thanks a lot for your replies
i have tried by not using offset.
i am binding node 1 with -b 127.0.0.1(localhost)
and node 2 with -b 192.168.16.228
i am able to load balance the instances but not able to replicate the session
say i start node 1 like this
standalone.bat -b 127.0.0.1 and node 2 like standalone.bat -b 192.168.16.228
if i try to access my app, either one of the nodes will serve the request. if say, node 2 servered the request and if i kill node 2 new session is being created on node1 but the session info is lost
i dunno what conig i am missing
by the way, i am using apache 2.2 as front end with mod_jk and jboss 7.1.1
thanks
-
9. Re: How to achieve session replication among jboss clusters in jboss As 7.1
rhusar May 30, 2012 9:54 AM (in response to chaitu1011)Can you check the log and see that the server really formed? First the joining node outputs the number of cluster nodes
17:39:27,931 INFO [org.jboss.as.clustering.impl.CoreGroupCommunicationService.web] (MSC service thread 1-1) JBAS010206: Number of cluster members: 2
and then you should see the cluster view that contains both nodes
17:39:28,382 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (pool-15-thread-1) ISPN000094: Received new cluster view: [rhusar1/web|1] [rhusar1/web, rhusar2/web]
this looks ok
by the way, i am using apache 2.2 as front end with mod_jk and jboss 7.1.1
Maybe you are testing it wrong? :-) Make sure you are accessing the load-balancer, not the sessions directly.
-
10. Re: How to achieve session replication among jboss clusters in jboss As 7.1
chaitu1011 May 30, 2012 11:09 AM (in response to rhusar)Hi again Rado,
if i run standalone -b 127.0.0.1 and standalone -b 192.168.16.228
it doesnt show me that number of clustered members =2
but if i run like standalone -b 192.xxx.xx.xx
and
standalone -b 192.168.16.228
it shows me num of clustered nodes=2
-
11. Re: How to achieve session replication among jboss clusters in jboss As 7.1
ctomc May 30, 2012 5:12 PM (in response to chaitu1011)Hi,
you should be running cluster configuration of AS
standalone-ha.xml or standalone-full-ha.xml are the ones
so for your use case you need to do something like this:
standalone -c standalone-ha.xml -b 192.168..xxx
might be that you will need to apply same configration changes that you did to original standalone.xml
--
tomaz