Wednesday, January 6, 2010

Setting up Mobicents JAIN SLEE Server's SIP11 RA in clustered and load balanced environment

What we are trying to demonstrate is, running the sip11 resource adaptor in clustered and load balanced environment within Mobicents JAINSLEE server. How we will achieve it is, by running two instances of the Mobicents server on same machine and using the sip-balancer tool. How exactly we can do this is, as follows:

Requirements:

1. JBoss AS 5.1.0.GA
2. sip11 RA from trunk (revision 9249)
3. sip-balancer from trunk (revision 9250)

The load balancing scenario which this setup fits in is:



Steps given below:

1. Create a copy of "all" server node in JBoss AS, rename it to say, "all2"

2. Go to /jboss-5.1.0.GA/server/all2/conf/bindingservice.beans/META-INF, and make following changes in bindings-jboss-beans.xml:
  • Bean - ServiceBindingManagementObject's parameter is to be changed to point to the next port, instead of the default one. Change ${jboss.service.binding.set:ports-default} to
    ${jboss.service.binding.set:ports-01}
3. This step has got nothing to do with Mobicents server. However, JBoss Messaging Service cribs about the peer-ID not being unique since we are using same machine with two nodes.
Go to JBoss/jboss-5.1.0.GA/server/all2/deploy/messaging
  • Change "messaging-service.xml" to allocate unique peer id. MBean ServerPeer's ServerPeerID must be given a new value instead of 0 -
    ${jboss.messaging.ServerPeerID:1}
4. Edit sip11 RA's "du/src/main/resources/META-INF/deploy-config.xml" to specify the PORT property, to be anything other than 5060, as that's the port for your External IP Load Balancer. So, say we opt it to be 5070.
Further, uncomment the BALANCERS and OUTBOUND_PROXY properties from the same file.

Now your file should look like this:

< deploy-config >

< ra-entity resource-adaptor-id=
"ResourceAdaptorID[name=JainSipResourceAdaptor,vendor=net.java.slee.sip,version=1.2]" name="SipRA" >

< properties >

< property name="javax.sip.PORT" type="java.lang.Integer" value="5070" / >

< property name="org.mobicents.ha.javax.sip.LoadBalancerHeartBeatingServiceClassName" type="java.lang.String" value="org.mobicents.ha.javax.sip.LoadBalancerHeartBeatingServiceImpl" / >

< property name="org.mobicents.ha.javax.sip.BALANCERS" type="java.lang.String" value="127.0.0.1:5060" / >

< property name="javax.sip.OUTBOUND_PROXY" type="java.lang.String" value="127.0.0.1:5065" / >

< /properties >
< ra-link name="SipRA">
< /ra-entity >



5. After setting the JBOSS_HOME to point to your JBoss AS, in your command prompt. Build the RA:
mvn install -Dnode=all

6. The DU.jar would be deployed in JBoss/jboss-5.1.0.GA/server/all/server/default/deploy
Copy it from there and paste it in, JBoss/jboss-5.1.0.GA/server/all/deploy
Paste it in "all2" node as well: JBoss/jboss-5.1.0.GA/server/all2/deploy, edit deploy-config.xml in this jar, to set the PORT property to port number: 5080 (anything other than 5060, the port of external LB and 5070, the port of sip11 RA in "all" node)

7. Build sip-balancer tool using "mvn install"

8. In target thus created, add "lb.properties" file. It should look like this:
host=127.0.0.1
internalPort=5065
externalPort=5060
#JSIP stack configuration
javax.sip.STACK_NAME = SipBalancerForwarder
javax.sip.AUTOMATIC_DIALOG_SUPPORT = off
// You need 16 for logging traces. 32 for debug + traces.
// Your code will limp at 32 but it is best for debugging.
gov.nist.javax.sip.TRACE_LEVEL = 32
gov.nist.javax.sip.DEBUG_LOG = logs/sipbalancerforwarderdebug.txt
gov.nist.javax.sip.SERVER_LOG = logs/sipbalancerforwarder.xml
gov.nist.javax.sip.THREAD_POOL_SIZE = 64
gov.nist.javax.sip.REENTRANT_LISTENER = true

9. Start the balancer by following command in target directory:

java -jar sip-balancer-1.0.BETA10-
SNAPSHOT-jar-with-dependencies.jar -mobicents-balancer-config=lb.properties

10. Start the JBoss nodes
"all" and "all2" by,
./run.sh -c all -b 127.0.0.1

Its good to go now. They are clustered, as well as load balanced :)