Introduction to Wildfly clustering

In this tutorial we will try to configure wildfly cluster and test it by deploying a picketlink enabled war application where a user can log...

In this tutorial we will try to configure wildfly cluster and test it by deploying a picketlink enabled war application where a user can login and the session shared between the virtual server.

Before we start, make sure that you read these links:

The concept of wildfly clustering is already discussed in the previous links so we will just enumerate the steps we've done and provide a sample war.

This is how I configured my servers (note that I'm using Wildfly 8.1 Final). Basically we have 2 physical machine, windows (master) and slave (ubuntu). Windows is the domain controller, while ubuntu has host controller and 2 virtual servers. Note that we need to manually deploy wildfly on both servers.

-Windows (IP=
--domain controller
-Ubuntu (IP=
--host controller

2 server groups

You may refer to the following images for reference.

We need to create a slave user in the master's machine. This user will be use by the slave server later on. To create a user account (username / password) run wildfly/bin/add-user.bat. Take note of the password as we will need to convert it later to base64.

Here are the configuration changes that we need to do:
On master, wildfly/domain/configuration/host.xml, we need to update the correct ip address, don't use
 <interface name="management">
  <inet-address value="${}"/>
 <interface name="public">
  <inet-address value="${jboss.bind.address:}"/>
 <interface name="unsecure">
  <inet-address value="${jboss.bind.address.unsecure:}"/>

Then on slave machine, rename host.xml to host.bak.xml and rename host-slave.xml to host.xml. We need to update the following:
//set host name to slave
<host name="slave" xmlns="urn:jboss:domain:2.1">

//set domain controller, point to master's ip
   <remote host="" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>

//set the secret key, basically it's the base64 representation of your slave password
  <!-- Replace this with either a base64 password of your own, or use a vault with a vault expression -->
  <secret value="xxxxxx"/>

In your master's domain.xml file, don't forget to set the hornetq-server's cluster-password.
<subsystem xmlns="urn:jboss:domain:messaging:2.0">

Run the server on both machine. And you should get the images I've posted above. The topology will become:

To test if the clustering is working download the project from:

Download, build with maven and deploy on the 2 server groups:

Now we can access the application from:

To test if clustering is working we need to setup cluster module from apache which is properly documented here:


wildfly 874336218192181323

Post a Comment Default Comments


Are you looking for freelancers in the Philippines? Get in touch.


If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.