Introduction

Setting up a RedHat JBoss EAP cluster in domain mode which provides centralized management of multiple JBoss instances, making it easier to deploy applications, manage configurations, and ensure high availability.

JBoss EAP Domain Mode Architecture

Environment Setup


Prerequisites

Three virtual machines provisioned with the following specifications:

Node IP Address Hostname Resources
Node 1 (Domain Controller) 192.168.0.101 jboss-master CPU: 2, Memory: 4GB
Node 2 (Worker) 192.168.0.102 jboss-worker1 CPU: 2, Memory: 4GB
Node 3 (Worker) 192.168.0.103 jboss-worker2 CPU: 2, Memory: 4GB

Implementation Steps


Common Setup for All Nodes

  1. Set Hostname

    Run the following command on each node to set its hostname:

    sudo hostnamectl set-hostname <hostname>
    exec bash

    Replace <hostname> with jboss-master, jboss-worker1, or jboss-worker2 as appropriate.

  2. Install Java JDK

    Install OpenJDK 17:

    sudo dnf install java-17-openjdk.x86_64 java-17-openjdk-devel.x86_64 java-17-openjdk-headless.x86_64 
  3. Configure Java Environment

    Add Java to your PATH by editing the .bashrc file:

    nano ~/.bashrc

    Add these lines at the end of the file:

    export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")
    export PATH=$JAVA_HOME/bin:$PATH

    Apply the changes:

    source ~/.bashrc
  4. Download JBoss EAP

    Download JBoss EAP 8.0.0:

    wget https://developers.redhat.com/content-gateway/file/eap/8.0.0/jboss-eap-8.0.0.zip
  5. Extract JBoss EAP

    unzip jboss-eap-8.0.0.zip

Domain Controller (Master Node) Setup


  1. Rename the JBoss Directory

    mv jboss-eap-8.0 jboss-master
  2. Create Host Configuration File

    Copy the host-primary template to create a master configuration:

    cp jboss-master/domain/configuration/host-primary.xml jboss-master/domain/configuration/host-master.xml
  3. Configure the Host Master File

    Edit the jboss-master/domain/configuration/host-master.xml file:

    nano jboss-master/domain/configuration/host-master.xml

    XML Configuration Changes for Master Node


Step 1: Locate the opening <host> tag near the top of the file and change its name attribute:

<host xmlns="urn:jboss:domain:20.0" name="master">

Step 2: Find the <management-interfaces> section (typically in the middle of the file) and ensure it looks like this:

<management-interfaces>
    <http-interface http-authentication-factory="management-http-authentication">
        <http-upgrade enabled="true" sasl-authentication-factory="management-sasl-authentication"/>
        <socket interface="management" port="${jboss.management.http.port:9990}"/>
    </http-interface>
</management-interfaces>

Step 3: Locate the <interfaces> section (usually towards the end of the file) and modify the management interface to bind to your specific IP:

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:192.168.0.101}"/>
    </interface>
</interfaces>
  1. Create Admin User

    Run the following script to create an administrative user:

    ./jboss-master/bin/add-user.sh

    Follow the prompts to:

    • Select Management User (option a)
    • Set username (e.g., “jboss”)
    • Set password (e.g., “jboss123”)
    • Confirm password
    • Enter group information (optional)
    • Confirm the information is correct
    • Indicate that this user will be used for one AS process to connect to another (y)
  2. Start the Domain Controller

    Launch the domain controller:

    ./jboss-master/bin/domain.sh --host-config=host-master.xml
  3. Verify Domain Controller Operation

    Access the management console:

    http://192.168.0.101:9990

    Log in with the admin user credentials created earlier.

Worker Node Configuration


Perform these steps on both worker nodes (jboss-worker1 and jboss-worker2).

  1. Rename the JBoss Directory

    After completing the common setup (steps 1-5):

    mv jboss-eap-8.0 jboss-worker1
  2. Create Host Configuration File

    Copy the host-secondary template to create a worker configuration:

    cp jboss-worker/domain/configuration/host-secondary.xml jboss-worker/domain/configuration/host-worker.xml
  3. Configure Host Worker Files

    Edit the jboss-worker/domain/configuration/host-worker.xml file:

    nano jboss-worker/domain/configuration/host-worker.xml

    XML Configuration Changes for Worker1 Node

    Step 1: Locate the opening <host> tag near the top of the file and change its name attribute:

    <host xmlns="urn:jboss:domain:20.0" name="worker1">

    Step 2: Find the <management-interfaces> section and update the port to avoid conflicts:

    <management-interfaces>
        <http-interface http-authentication-factory="management-http-authentication">
            <http-upgrade enabled="true" sasl-authentication-factory="management-sasl-authentication"/>
            <socket interface="management" port="${jboss.management.http.port:9980}"/>
        </http-interface>
    </management-interfaces>

    Step 3: Locate the <domain-controller> section and update it to point to the master node:

    <domain-controller>
        <remote authentication-context="secondary-hc-auth-context">
            <discovery-options>
                <static-discovery name="master" protocol="${jboss.domain.primary.protocol:remote+http}" host="${jboss.domain.primary.address:192.168.0.101}" port="${jboss.domain.primary.port:9990}"/>
            </discovery-options>
        </remote>
    </domain-controller>

    Step 4: Find the <authentication-client> section and update it with the correct credentials:

    <authentication-client>
        <authentication-configuration name="secondary-hc-auth" authentication-name="jboss" realm="ManagementRealm" sasl-mechanism-selector="DIGEST-MD5">
            <credential-reference clear-text="jboss123"/>
        </authentication-configuration>
        <authentication-context name="secondary-hc-auth-context">
            <match-rule authentication-configuration="secondary-hc-auth"/>
        </authentication-context>
    </authentication-client>

    XML Configuration Changes for Worker2 Node


Follow the same steps as Worker1, but use “worker2” as the host name:

<host xmlns="urn:jboss:domain:20.0" name="worker2">

You may also want to use a different management port to avoid conflicts, such as:

<socket interface="management" port="${jboss.management.http.port:9970}"/>

All other configurations remain the same as Worker1.

  1. Start the Worker Nodes

    Launch each worker node:

    ./jboss-worker/bin/domain.sh --host-config=host-worker.xml

Verification


  1. Access the Domain Controller Management Console

    Navigate to:

    http://192.168.0.101:9990
  2. Verify Cluster Status

    • Log in with the admin credentials
    • Navigate to the “Runtime” tab
    • Verify that all three nodes (master, worker1, worker2) appear in the host list
    • Check that all server instances are running properly

JBoss Management Interface

Now a functional 3-node JBoss EAP cluster running in domain mode. This setup provides centralized management, simplified deployments, and improved availability for your Java enterprise applications.