Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JBoss Fuse—How to Setup Cluster of Servers in Fabric

DZone's Guide to

JBoss Fuse—How to Setup Cluster of Servers in Fabric

· Integration Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

Staying in Beijing for a technical enablement, one question I have been ask a lot is how to setup a Fabric in a cluster of servers with JBoss Fuse?

I am going to setup 2 Fuse on 2 different servers, and then join them together to form a fabric cluster.

BUT! In the real world please make it at least 3 servers, as zookeeper needs more then 3 to successfully setup it's ensembles!

First we need to create a fabric, so unzip the JBoss Fuse zip file in Server1, setup password by editing etc/user.properties.

And please do the same thing to server2. If you are testing, and tries to setup on the same machine, please remember to go to "org.apache.karaf.management.cfg" under etc/ and change the RMI related port.


Also there are a few more port you need to adjust,

org.apache.karaf.shell.cfg, change the:

  • sshPort

and last inside system.properties

  • org.osgi.service.http.port
  • activemq.port
  • activemq.jmx.url

Now, getting back to setting the cluster of fabric, start up JBoss Fuse by going into bin/ and execute fuse on server one. After it starts up, create a fabric by entering the following command:

fabric:create --wait-for-provisioning

This spins up a fabric on a container call root, now, start up JBoss Fuse on server2 by going to bin/ and execute fuse on server two. And instead of creating a fabric, we are going to join, by entering following command, as fabric:join [options] zookeeperUrl [containerName].

fabric:join --zookeeper-password admin 192.168.0.1:2181 root1

To find out what the zookeeper URL, go to your fuse command line console in Server1 and type:

config:edit io.fabric8.zookeeper
config:proplist

This will give you your zookeeper details:

                       JBossFuse:karaf@root> config:proplist
            service.pid = io.fabric8.zookeeper
            zookeeper.password = ZKENC=YWRtaW4=
            zookeeper.url = 192.168.0.1:2181
            fabric.zookeeper.pid = io.fabric8.zookeeper

And now we have successfully created a fabric on 2 servers. If you type in container-list in the command line, you should be able to see we now have 2 working server.

JBossFuse:karaf@root> container-list 
[id]                           [version] [connected] [profiles]                                         [provision status]
root*                          1.0       true        fabric, fabric-ensemble-0000-1, jboss-fuse-full    success
root1                          1.0       true        fabric                            

And if you login to Fuse management console, under Runtime-> Containers you will see the 2 root containers on both servers

To add a new container, click on +Create on top right hand corner of the page, select the parent container so it will run on the server base on the parent container. Then choose the profile you need to install on the container.

And we are done!



Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}