no

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:
https://docs.jboss.org/author/display/AS71/AS7+Cluster+Howto
http://blog.arungupta.me/2014/03/wildfly-8-clustering-and-session-failover/

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=192.168.0.100)
--domain controller
-Ubuntu (IP=192.168.0.116)
--host controller

2 server groups
-main-server-group
-other-server-group

You may refer to the following images for reference.
Master
Slave

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 127.0.0.1:
<interfaces>
 <interface name="management">
  <inet-address value="${jboss.bind.address.management:192.168.0.100}"/>
 </interface>
 <interface name="public">
  <inet-address value="${jboss.bind.address:192.168.0.100}"/>
 </interface>
 <interface name="unsecure">
  <inet-address value="${jboss.bind.address.unsecure:192.168.0.100}"/>
 </interface>
</interfaces>

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
<domain-controller>
   <remote host="192.168.0.100" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/>
</domain-controller>

//set the secret key, basically it's the base64 representation of your slave password
//http://www.freeformatter.com/base64-encoder.html
<server-identities>
  <!-- Replace this with either a base64 password of your own, or use a vault with a vault expression -->
  <secret value="xxxxxx"/>
</server-identities>

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">
 <hornetq-server>
  <cluster-password>${jboss.messaging.cluster.password:absolutely}</cluster-password>

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:
https://github.com/czetsuya/picketlink-authentication-jsf

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

Now we can access the application from:
http://192.168.0.110:8080/jboss-as-picketlink-authentication-jsf/home.jsf

To test if clustering is working we need to setup cluster module from apache which is properly documented here: https://docs.jboss.org/author/display/AS71/AS7+Cluster+Howto.

Related

wildfly 874336218192181323

Post a Comment Default Comments

item