Wednesday, April 27, 2016

Colocated Symmetrical Live and Backup Cluster on Jboss EAP - With Parameterization

            For demonstrating the HA fail-over mode with parameters, this article will use two nodes, the configuration can however be extended as needed to numerous nodes. Traditionally for the Collocated failover mode setup, the full ha profile in the domain.xml will be replicated (after the hornetq server is itself copied over in the profile to create a back-up), this however will become tedious approach when there are say 4 or 5 cluster live and back up combinations.  Follow the below steps and life should be a little more easy

Step 1 : 
Dowload the jboss eap 6.4 version
Make two copies of the unzipped folder as master and node.
Step 2 :
Open domain.xml under the master/domain/configuration directory
Delete the profile default , ha , full
Navigate to the messaging subsystem under full-ha profile
Copy the hornetq-server and paste it right after the first hornet-server section
Provide a name to the second hornetq-server to differentiate it from the first , it can be any name , let us choose backup as the name.


Step 3:  Make changes to the  default hornet-server section  as below
           

            
The line no 14 shows the parameterization , the group name of the default server is now provided by the parameter groupa while the servers are configured to start. Also change the server-id of the in-vm connector and acceptor to a unique number on line numbers 24 and 35 ,this is because we are have to differentiate between the live and back up server ( which we are going to configure in next step )


Step 4:  Change the configuration the back-up server created by copying the original hornetq-server as below
            


                The line number 6 is changed to appropriately represent that this server will act as a back up . The backup group name is now represented by the parameter groupb .Also the server-id is now incremented to 2 to make it different from the live server running on  the same server . Also observe the changes on the socket-binding to messaging2 , this is to cater to the need that the backup server belonging to ${groupb} will come up when its master on a different server comes down . During such times this will help resolve the port-conflict that will arise with the groupa live server running on the current server. ( Jump to Step 4 to see the actual configuration of the socket-binding )

Step 4 :
            Move to the full-ha-sockets section of the socket-binding-group, create a new socket-binding named messaging2 and provide the port as 5446 ( you can opt to provide any number which would be different from the messaging socket-binding and which will not conflict with the other eap ports , this is a tested out port).

Step 5 :
            Move to the server-groups section and remove one of the server-group referring to the “full” profile . Change the server group name to “hornetqparamcluster”, this can be any thing or you can choose to leave the name as is, just remember the name.

Step 6:
Create a copy of the host-slave.xml file under the master/../configuration directory.

Step 7 :
Run the script ./add-user.sh under the master/bin directory ( this will be domain controller node ) , create a Management Realm user called admin .
Run the script once again and create a user called myhornetqcluster , during the interactive steps , as shown below.



         Copy the text <secret value="xxxxxx"/> 

Step 8 : 
  •  Open the host-slave.xml file under the master/../configuration directory and add the below text under the management security realm node 
         <server-identities>
               <secret value="xxxxxx"/>
         </server-identities>
         where xxxxxx is the text copied in the Step 7.
  • Move to the domain-controller section and remove the <local/> node and uncomment the <remote> node, add the attribute  username to the node with the value as “myhornetqcluster”  created in step 7.
  • Repeat the above two steps for the file host-slave-node.xml
  • Move to the servers section of the file host-slave.xml and change the group of the server to hornetqparamcluster .
  • Add the system properties section to provide values to the ${groupa}  and ${groupb} parameters , provide the offset to 1000. Remove the second server configuration.
  • Repeat the above step by editing the host-slave-node.xml but reverse the values of groupa and groub parameters , also provide the offset to 2000 , (remember we are running all the nodes on the single server ).

Step 9
  • Start the domain controller  by running domain.sh under /master/bin as below

            ./domain.sh --domain-config=domain.xml --host-config=host-master.xml -b=192.168.56.101 
           -bmanagement=192.168.56.101
  • Start the hornetq live server group by running the domain.sh under /master/bin in a separate window

         ./domain.sh --domain-config=domain.xml --host-config=host-slave.xml 
        -b=192.168.56.101 -bmanagement=192.168.56.101 
        -Djboss.domain.master.address=192.168.56.101 -Djboss.management.native.port=9993
  • Start the hornet second live server group by running the domain.sh under /node/bin in a separate window

         ./domain.sh --domain-config=domain.xml --host-config=host-slave-node.xml 
        -b=192.168.56.101 -bmanagement=192.168.56.101 
        -Djboss.domain.master.address=192.168.56.101 -Djboss.management.native.port=9993


        Change the IP address to the address of your server.
          You should now have the hornetq servers in Colocated Symmetrical Live and Backup Cluster on Jboss EAP.


No comments:

Post a Comment