January 5, 2013

How to Cluster Domain JBoss EAP 6 and AS 7


In my previous blog I showed how to cluster with JBoss EAP 6.0.3 in standalone mode, but standalone mode is really used in production, where the domain mode is the preferred way to manage multiple JBoss installations.

In this blog I will also cluster two JBoss nodes, but started in domain mode. To achieve that we need a domain master (domain controller) and slave (host controller), that push and respectively receive configuration. The deployment scenario is the following.

I have in the deployment diagram also added the concerned configuration file for each artifact, which I hope will help you to remember which configuration files goes to which artifact. Lets get started, but first some prerequisites.


In this blog I will start everything up on the same machine, which is adequate for testing, but of course not for production, so when you move to production you need to change interfaces IP for each JBoss. But that is about it. Lets get started.

To simulate and keep things separated I have extracted the jboss-eap-6.0.1.zip into three folders:

  • domain
  • host1
  • host2

Domain Controller

The domain controller is configured with three configuration files.

  • domain.xml - main configuration files
  • host-master.xml - boot up configuration files, telling that this is domain controller.
  • host.xml - additional configuration files for server group, such as system-wide properties and JVM configuration.

Lets first define our server group in ./domain/domain/configuration/domain.xml.

Then we will leave the ./domain/domain/configuration/host-master.xml unaltered and use defaults. The part that points out that this is domain controller is the below.

The last thing we need to do is to create a management user in the domain controller.

Now we are ready to start the domain controller.

If you wanted to bind the domain controller to a specific IP, you would have used the -Djboss.bind.address.management. Which property you see in the interface element in the host-master.xml configuration file.

Now lets move onto the host controller.

Host Controller

A host controller is a slave to the domain controller which listen for configuration and start/stop instruction. The host controller then feeds that information to all server node on a physical machine. The host controller is not really something special to only domain mode, but is also present in a standalone mode, but then not really used.

Lets get started with the configuration for the host controller. Lets open ./host1/domain/configuration/host-slave.xml and define the server nodes that will be managed by this host controller.

Since we are running everything on the same machine, we need to set the port-offset property. If this was running on a dedicated server you leave that out.

We use the server group that was defined in the domain controller.

Next we need to set up security to the domain controller. The host controller needs to know how to establish a connection to the domain controller. Here we use the same base64 password that we recieved when creating the management user for the domain controller.

The last thing we need to change, and this is because we are running everything on the same machine is the management port.

Now lets multiply the above configuration to host 2 also.

Now we are ready to start the host controllers.

You should now see the following in the domain controller log.

Test Installation

To test is installation, we need a clustered application. I will as in my earlier blog borrow a ready application from https://github.com/akquinet/jbosscc-as7-examples/tree/master/cluster-example.

But now we will use the new JBoss CLI tool to deploy and start and stop our server nodes. See my previous blog on how to deploy with CLI http://magnus-k-karlsson.blogspot.se/2013/01/how-to-deploy-and-undeploy-in-jboss-eap.html.

If you now look in each host controller log file, you should see the deployment. If everything is ok. Lets test the application, open

Now lets stop the server node, that you were served and test the replication.

And you should now see in that node server log.

Lets now hit the application again.


Paul Rubenis said...

Have you setup VAULT in a domain configuration for EAP 6? I have spent some time on this and can't seem to get the setup correct. The documentation seems to be lacking for this configuration.

Magnus K Karlsson said...

Look at the JBoss EAP documentation, they have a good step by step guide


Robert de Heer said...

Have you deployed an ear into multiple servers in the same group via cli? I have a slave that is connected to a master domain controller. When I deploy an ear to a server group, it is only deployed on the master. I expected it to be deployed to each server in the group.

Anonymous said...

Hi! :) thanks for the instructions, really helped me. Is there any instructions for configuration of the mod_cluster and the slaves (for your specific cluster configuration which you described here)?

asif soomro said...
This comment has been removed by the author.
asif soomro said...

an we find the secret value " secret value="bm9kZTFpZA=" in configuration file, once we created the user ?


Asif Ali,

Kereana K said...

Well explained each points. Such an interesting post. Thank you for sharing.
web development company in Bangalore | Website Design Company in Bangalore | cms company in Bangalore| hire CMS developers in bangalore