Monday, December 22, 2014

Jboss Clustering in Domain mode

In last blog we saw how to create jboss cluster in standalone mode. Lets do the same now for domain mode. For clustering in domain we need to make couple of entry in some configuration files. First of all we will make entry in domain.xml file which can be found inside jbosshome/domain/configuration/domain.xml file. First of all we will add a new server-group inside the server-groups tag and will name this group ha-server-group which would be using ha profile and ha socket binding group where ha is for cluster enabled. Below is the entry that we need to make to this file:-

<server-group name="ha-server-group" profile="ha">
            <jvm name="default">
                <heap size="64m" max-size="512m"/>
            </jvm>
         <socket-binding-group ref="ha-sockets"/>
</server-group>


Where profile: tells which type of profile is been used (i.e. web, messaging, cluster,full),socket-binding-group: tells which all type of protocols is been used (i.e. web [http,ajp], messaging, jgroups [udp, tcp], full) and server-group : tells what profile is been used and what type of sockets is been used.

After that we need to add two nodes with the name ha-server-1 and ha-server-2 which we are going to use in ha-server-group. The entry will be made in jbosshome/domain/configuraion/host.xml. Below is the entry that we need to add inside servers tag:-

<server name="ha-server-1" group="ha-server-group" auto-start="true">
            <socket-bindings port-offset="100"/>
        </server>
        <server name="ha-server-2" group="ha-server-group" auto-start="true">
        <socket-bindings port-offset="200"/>
        </server>

Next step is to configure a new user using adduser.bat file as done in the previous two blogs.

Once everything is done we need to start the server by using the domain.bat file, however we would not see that the nodes ha-server-1 and ha-server-2 are in a cluster for that you would have to deploy an application which has the distributable tag in web.xml file.

So, lets deploy the same sample application by logging to the admin console:-http://localhost:9990/console. Once the deployments is done click on the add to grops button to add the deployments to the ha-server group. Now try accessing the application on the below URLs:-
http://localhost:8180/JbossClusterWebApp and  http://localhost:8280/JbossClusterWebApp.Then bring any of the server down from the admin console and try accessing the application on the other server.

That's it for clustering in domain mode.

Thanks for reading.


No comments:

Post a Comment