[How To] Create Fuse ESB & MQ fabric cluster with failover on RHEL,Ubuntu

This is my first of the many findings that I will post about FuseESB/MQ middleware products. After lots and lots of iterations, I have narrowed down the step by step process of creating a Fuse Fabric server cluster with failover setup on Oracle dB. The setup is as follows:
1. Node1 – Server hostname – ESBNode1 – Contains installation of Fuse ESB and Fuse MQ
2. Node2 – Server hostname – ESBNode2 – Contains installation of Fuse ESB and Fuse MQ
3. Node3 – Server hostname – FuseFMC –  Contains installation of FMC
4. Node1 and Node2 will have two FuseMQ child brokers to allow messaging failover.
The setup described below has been tested with Fuse 7.1 , jdk 1.6 & jdk 1.7 on RHEL 6 and Ubuntu 12.04/12.10/13.04.  Please let me know if this is not working for you, or if I have missed a step.
This tutorial assumes that Fuse ESB, MQ and FMC are already installed on their respective servers and are installed as services.
Disclaimer: Please test this setup in a test environment or local machine. Do not try this out directly on a production server. I accept no responsibility if your server goes down after installation.

Setup Java JDK
Download JAVA JDK 1.7 rpm from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html to the required servers. Install the rpm using the following command :
sudo rpm -ivh jdk-7u21-linux-x64.rpm
Note: the name of the rpm given above is an example, the latest Java package name will be different. For Ubuntu based systems either you can convert the rpms into a deb using alien or use the Webupd8 Java ppa
Setup Java Home
Create a java.sh file in /etc/profile.d/
sudo vi /etc/profile.d/java.sh
and add the following
export JAVA_HOME=/usr/java/jdk1.7.0_21
export PATH=”${JAVA_HOME}/bin:$PATH”
save and exit out and refresh the profile to check the Java home path
:wq 
source /etc/profile
echo $JAVA_HOME to check if the path is set correctly
Setup JAVA alternatives
Oracle Java JDK needs to be setup as an alternative to java-gcj which is the default Java for RHEL. Use the following command to setup the default Java for the whole system.
sudo /usr/sbin/update-alternatives –install “/usr/bin/java” “java” “/usr/java/jdk1.7.0_17/bin/java” 2
sudo /usr/sbin/update-alternatives –config java
For Ubuntu
If you install Java via webupd8 ppa, Java is installed in /usr/lib/jvm/, so set the paths accordingly
sudo update-alternatives –install “/usr/bin/java” “java” “/usr/lib/jvm/java-7-oracle/bin/java” 2
sudo update-alternatives –config java
Setup Fabric Cluster
1) Before Creating Fabrics for both nodes, it is important to add the below two jar files in this location /opt/FuseMQEnterprise-7.1.0/lib/ext.
c3p0-0.9.1.2.jar
ojdbc6.jar
2) Stop the services and run the fuse esb, mq  and fmc servers as from the terninal using
bin/fuseesb 
bin/fusemq
bin/fmc

3)Create fabric on both ESB and MQ of ESBNode1and ESBNode2 servers using the following command. The default password generated will be admin

fabric:create –clean
fabric:create –clean
4) Join ESB and MQ Containers of ESBNode1 into ESBNode2
fabric:join –zookeeper-password admin ESBNode1:2181 
fabric:join –zookeeper-password admin ESBNode1:2181 
5) Create Ensemble for the containers
ensemble-add mq-root-node02 fuseroot-node02
6) Create Children from any of the Console for both ESB’s. Run fuseesb from console, not as service Use FMC to create Child containers or use the following commands
container-create-child fuseroot-node01 fuse-containername-node01
container-create-child fuseroot-node02 fuse-containername-node02
7) Create MQ child containers for each node. Create child mq-broker profiles for each node from FMC. Each broker (mq child container) should have its own profile
For FuseMQ on node1
container-create-child mq-root-node1 mq-child1-node1
container-create-child mq-root-node1 mq-child2-node1
For FuseMQ on node2
container-create-child mq-root-node2 mq-child1-node2
container-create-child mq-root-node2 mq-child2-node2
8) Find the Zookeeper URL to add all containers into FMC. Use the following commands to find out.
config:edit org.fusesource.fabric.zookeeper
config:proplist
example :
        service.pid = org.fusesource.fabric.zookeeper
        zookeeper.password = 7Aiqgl25jIMr9rc3
        zookeeper.url = ESBNode1:2182,ESBNode2:2181,ESBNode2:2182
        fabric.zookeeper.pid = org.fusesource.fabric.zookeeper
config:cancel
Add any of the above URLs to join FMC to the fabric. In this example we will use the following info:
Host:ESBNode2
Prot:2181
password:7Aiqgl25jIMr9rc3
Once all containers are joined, they will show up on the FMC.
9) Stop All MQ children for both nodes from FMC or use the following command on the console
container-stop mq-child1-node1,mq-child2-node1,mq-child1-node2,mq-child2-node2
10) Modify broker.xml in the parent profile for mq-base from FMC

  • goto profiles tab click profile mq-base
  • goto config-files tab and open broker.xml
  • add the below snippet to broker.xml

 <bean id=”oracle-ds” class=”com.mchange.v2.c3p0.ComboPooledDataSource”>
        <property name=”driverClass” value=”oracle.jdbc.driver.OracleDriver” />
        <property name=”jdbcUrl” value=”jdbc:oracle:thin:@oracle-server-hostname:port:databasename” />
        <property name=”user” value=”username” />
        <property name=”password” value=”password” />
        <property name=”acquireRetryAttempts” value=”50″ />
        <property name=”maxIdleTime” value=”500″/>
        <property name=”idleConnectionTestPeriod” value=”1800″ />
        <property name=”preferredTestQuery” value=”SELECT 1″ />
        <property name=”minPoolSize” value=”5″ />
        <property name=”maxPoolSize” value=”500″ /> 
    </bean>
Also, modify the below snippet
  <persistenceAdapter>
            <kahaDB directory=”${data}/kahadb”/>
  </persistenceAdapter>
to
 <persistenceAdapter>
            <jdbcPersistenceAdapter dataSource=”#oracle-ds”/>
  </persistenceAdapter>
for changing the dB connection to Oracle.
11) Add boot delegation Properties to children of MQ for both nodes
For Node1
  • goto location where Fuse-MQ is installed in node1
  • goto instances you will find mq-child1-node1,mq-child2-node1
  • goto etc folder and open config.properties file
  • search for string org.osgi.framework.bootdelegation=
  • and append this string 

“,oracle.*,com.mchange.*” at the end and save.

For Node2
  • goto location where Fuse-MQ is installed in node2
  • goto instances you will find mq-child1-node2,mq-child2-node2
  • goto etc folder and open config.properties file
  • search for string org.osgi.framework.bootdelegation=
  • and append this string 

 “,oracle.*,com.mchange.*” at the end and save

12) Create network connection of brokers from any of the karaf consoles
mq-create –group mq-network-broker1 –networks mq-network-broker2 –assign-container mq-child1-node1,mq-child1-node2 mq-broker-1
mq-create –group mq-network-broker2 –networks mq-network-broker1 –assign-container mq-child2-node1,mq-child2-node2 mq-broker-2
13) Now Start all the MQ child containers from FMC
14) If you want, you can install all the containers as services. This will help automate the startup process for all containers in the event of a reboot. From FMC –

  • Add Feature wrapper to the profile fuse-esb-full
  • Add Feature wrapper to the profile mq-broker1
  • Add Feature wrapper to the profile mq-broker2

Example:
container-connect node mq-child1-node1
wrapper:install -s DEMAND_START -n mq-child1-node1 -d mq-child1-node1 -D mq-child1-node1
ln -s /opt/FuseMQEnterprise-7.1.0/instances/mq-child1-node1/bin/mq-child1-node1-service /etc/init.d/
chkconfig mq-child1-node1-service –add
chkconfig mq-child1-node1-service on
FMC and Deploying bundles


You can access the Fuse Management console at http://node03:8107. Bundles can be deployed from there.

Please note, if you are running Fuse ESB and MQ as service you cannot create child containers from FMC cleanly. This is an inherent bug with Fuse 7.1 which has been fixed in recent versions of JBoss Fuse ESB

Leave a Reply

tuxtrixmod
Scroll to Top