JBoss domain setup

Cluster configuration

Env setup

We will use a single installation and different configuration folders to simulate remote hosts:

unzip jboss-eap-7.1.0.zip -d $HOME/JBossDomain

then we will create virtual hosts directory structure

export EAP_DOMAIN=$HOME/JBossDomain
mkdir host0 host1 host2
cp -r jboss-eap-7.1/domain host0/
cp -r jboss-eap-7.1/domain host1/
cp -r jboss-eap-7.1/domain host2/

domain user configuration

We will create a management user only for the host0 node

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./add-user.sh -dc $EAP_DOMAIN/host0/domain/configuration

Choose the following options:

Management User (mgmt-users.properties)
userName: admin
userPassword: Admin01#
GroupList: Empty, the user will be added by defautl to the ManagementRealm
Is this user going to be used for one AS process to connect etc etc: no

configure host authentication

We will create a second user for host authentication. We will need to repeat this step for all hosts.

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./add-user.sh -dc $EAP_DOMAIN/host0/domain/configuration

Choose the following options:

Management User (mgmt-users.properties)
userName: slave
userPassword: Slave01#
GroupList: Empty, the user will be added by defautl to the ManagementRealm: yes
Is this user going to be used for one AS process to connect etc etc: yes

When the add-user script complete, an encrypted password is generated in the output. Keep the encrypted generated password and replace the default secrete value for host1 and host2 server identities.
create the same user for host1 and host2, this time in batch mode

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./add-user.sh -dc $EAP_DOMAIN/host1/domain/configuration -r ManagementRealm -u slave -p Slave01# -ro admin,manager
./add-user.sh -dc $EAP_DOMAIN/host2/domain/configuration -r ManagementRealm -u slave -p Slave01# -ro admin,manager

replace the default secret value for host1 and host2


    <secret value="[your secret value]"/>

Set up the domain host and interfaces

We will update the host0/domain/host-master.xml file to set a correct hostname for preventing confusion in the domain configuration dashboard

cd host0/domain/configuration/
vi host-master.xml
edit host name to be host0-master
<host xmlns="urn:jboss:domain:4.1" name="host0-master">

Now we have to indicate that a host is a domain controller. We will locate the domain-controller section in the configurationfile and make sure its content matches the following structure:


The local tag indicates that this is a domain controller.

Configure slaves (host-slave.xml)

We will set up communications links between the domain controller and the hosts. For each host (host1, host2) edit the domain/configuration/host-slave.xml configuration file:

cd host1/domain/configuration
vi host-slave.xml
<host xmlns="urn:jboss:domain:4.1" name="host1">
cd host2/domain/configuration
vi host-slave.xml
<host xmlns="urn:jboss:domain:4.1" name="host2">

change the management interface default port to 19999 for host1 and 29999 for host2. Port 9999 is already used by the domain controller (host0):


<native-interface security-realm="ManagementRealm">
    <socket interface="management" port="${jboss.management.native.port:19999}"/>


<native-interface security-realm="ManagementRealm">
    <socket interface="management" port="${jboss.management.native.port:29999}"/>

Set up the right configuration so that the host can join the domain controller(repeat for host1 and host2):

    <remote security-realm="ManagementRealm">
        <static-discovery name="primary" protocol="${jboss.domain.master.protocol:remote}" host="${jboss.domain.master.address :}" port="${jboss.domain.master.port:9999}"/>

Remove the content of the servers tag (host1 and host2):

<servers> </servers>

Start the domain

Let's start the domain controller and the hosts:

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./domain.sh -Djboss.domain.base.dir=../host0/domain/ --host-config=host-master.xml

start host1 from another termial or tab

./domain.sh -Djboss.domain.base.dir=../host1/domain/ --host-config=host-slave.xml

start host2 from another terminal or tab

./domain.sh -Djboss.domain.base.dir=../host2/domain/ --host-config=host-slave.xml

you can see the host registering in domain controller logs.

Now you can connect do the domain controller:

login: admin, Password: Admin01#

Create a server group

We will connect to the CLI and create a lab server group with the ha profile and the associated ha-sockets binding group.

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./jboss-cli.sh -c
[domain@localhost:9999 /] /server-group=lab:add(profile=ha,socket-binding-group=ha-sockets)
    "outcome" => "success",
    "result" => "undefined",
    "server.groups" => "undefined"

Create some server instances

A server instance is cretaed on a host and belongs to one server group. Since we want to have many server instances on the same host, wi will shift the instances port offset, so we will add 100 to the base offset while moving from one server to another.

Host1 server creation

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./jboss-cli.sh -c
[domain@localhost:9999 /] /host=host1/server-config=node11:add(group=lab,socket-binding-port-offset=100)

Host2 server creation

cd $EAP_DOMAIN/jboss-eap-7.1/bin
./jboss-cli.sh -c
[domain@localhost:9999 /] /host=host1/server-config=node21:add(group=lab,socket-binding-port-offset=200)

in this way we will have node11 on port 8180 and node21 on port 8280

Now let's start the servers

[domain@localhost:9999 /] /server-group=lab:start-servers

Configure Datasources

We will configure JBoss Domain for postgresql.

cd $EAP_DOMAIN/jboss-eap-7.1/modues/system/layers/base/
mkdir -p org/postgresql/jdbc/main
cp $HOME/Downloads/postgresql-9.4.1211.jar org/postgresql/jdbc/main/
vi org/postgresql/jdbc/main/module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="org.postgresql.jdbc">
          <resource-root path="postgresql-9.4.1211.jar"/>
          <module name="javax.api"/>
          <module name="javax.transaction.api"/>
[domain@localhost:9999 /] /profile=ha/subsystem=datasources/jdbc-driver=postgresql:add(driver-name=postgresql,driver-module-name=org.postgresql.jdbc,driver-xa-datasource-class-name=org.postgresql.xa.PGXADataSource)

restart the domain.

JNDI configuration on Jboss web console

We will configure two datasources for the scope of this lab:
java:jboss/datasources/entandoDbPort2 and java:jboss/datasources/entandoDbServ2

Access to http://localhost:9990 user: admin password: Password01# and go to:


and select those options for create entandoDbPort2 JNDI:

  • Postgresql Datasource
  • Name: entandoDbPort2
  • JNDI Name: java:jboss/datasources/entandoDbPort2
  • Detected Driver: postgresql
  • Connection URL: jdbc:postgresql://localhost:5432/entandoDbPort2
  • user name: entando
  • password: entando

select those options for create entandoDbServ2 JNDI

  • Postgresql Datasource
  • Name: entandoDbServ2
  • JNDI Name: java:jboss/datasources/entandoDbServ2
  • Detected Driver: postgresql
  • Connection URL: jdbc:postgresql://localhost:5432/entandoDbServ2
  • user name: entando
  • password: entando


You'll only receive email when Pietrangelo Masala publishes a new post

More from Pietrangelo Masala