Skip to main content

How to setup Jboss Wildfly in Domain Mode with Remote Host Controllers ?

Domain mode feature of JBoss allows to manage multiple server instances from a single control point. The server configuration of the domain is centralized in the domain.xml file of the domain controller. The domain.xml is located at domain/configuration/. It includes the main configuration for all server instances. This file is only required for the domain controller.

In the domain.xml file, this file will use to define the server group configuration (which can be anyway changed at runtime). All the server groups which we will create or already created that will be define here.


<server-groups>
<server-group name="main-server-group" profile="full">
<jvm name="default">
<heap size="64m" max-size="512m"/>
</jvm>
<socket-binding-group ref="full-sockets"/>
</server-group>
<server-group name="other-server-group" profile="full-ha">
<jvm name="default">
<heap size="64m" max-size="512m"/>
</jvm>
<socket-binding-group ref="full-ha-sockets"/>
</server-group>
</server-groups>

How to setup Jboss Wildfly in Domain Mode with Remote Host Controllers
As you can see, we have two server groups: main-server-group and other-server-group. You can in turn associate each server group with a different profile.
The default configuration includes four preconfigured profiles:

  • default - Support of Java EE Web-Profile plus some extensions like RESTFul Web Services or support for EJB3 remote invocations
  • full - Support of Java EE Full-Profile and all server capabilities without clustering
  • ha - default profile with clustering capabilities
  • full-ha - full profile with clustering capabilities
A profile contains the configuration of the supported subsystems that is added by an extension. The referenced profile will be assigned by the server group to one socket-binding group. A socket-binding group references to logical interface names instead direct to the interfaces of a host. These logical interfaces are defined in the <interfaces> section of the domain.xml configuration file.




<interfaces>
        <interface name="management"/>
        <interface name="public"/>
        <interface name="unsecure"/>
    </interfaces>
Configuring the Domain Controller

We are using “wildfly-11.0.0.Final” for this example setup. The domain controller needs both the domain.xml and host.xml configured. In the $WF_HOME/domain/configuration directory, you'll see that those two files are joined by a host-master.xml and a host-slave.xml. These are pre-configured host.xml files which you can use to give you a head start in making a host.xml for the domain controller (master) and host controller (slave) to use.

We will use two machines:

The "DomMaster" (192.168.1.10) box, which will run the Domain Controller, hereafter called the DC. A "DomeSlave" (192.168.1.11), which will run a Host Controller, hereafter called the HC1. You can use multiple slaves with each an HC. The principle stays the same. But in following steps we use on slave:

Step 1) Unzip wildfly-11.0.0.Final.zip on the DC (IP eg. - 192.168.1.10), for example to /opt/wildfly-11.0.0.Final-Master

Step 2) Unzip wildfly-11.0.0.Final.zip on HC1 (IP eg. - 192.168.1.11), for example to /opt/wildfly-11.0.0.Final-Slave

Step 3) On the DC, edit /opt/wildfly-11.0.0.Final-Master/domain/configuration/host.xml and set its host name as follows: (the name should be unique in the whole domain)


<?xml version='1.0' encoding='UTF-8'?>

<host xmlns="urn:jboss:domain:5.0" name="DomMaster">
<extensions>
Step 4) On HC1, edit /opt/wildfly-11.0.0.Final-Slave/domain/configuration/host.xml and set its host name like follows: (the name should be unique in the whole domain)

<?xml version='1.0' encoding='UTF-8'?>

<host xmlns="urn:jboss:domain:5.0" name="DomSlave">
<extensions>

Step 5) On HC1, edit /opt/wildfly-11.0.0.Final-Slave/domain/configuration/host.xml and tell the DomSlave (HC1) where the DC is - here we need to use the actual hostname of the DC or IP address (192.168.1.10).

Change your <domain-controller> tag

<domain-controller>
<local/>
<!-- Alternative remote domain controller configuration with a host and port -->
<!-- <remote protocol="remote" host="${jboss.domain.master.address}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm"/> -->
</domain-controller>

with like this.

<domain-controller>
<remote host="${jboss.domain.master.address:192.168.1.10}" port="${jboss.domain.master.port:9999}" security-realm="ManagementRealm" username=”dcadmin”/>
</domain-controller>


Step 6) Now on the DC you will need to create a user, for each HC ( DomSlave in our scenario) you want to use, in the ManagementRealm. So in our scenario, create a user “dcadmin” for DomeSlave as we defined in <host name="DomSlave" ...>

Use the following script on the DC: /opt/wildfly-11.0.0.Final-Master/bin/add-user.sh


$./add-user.sh

What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : DCAdmin
Password recommendations are listed below. To modify these restrictions edit the add-user.properties configuration file.
- The password should be different from the username
- The password should not be one of the following restricted values {root, admin, administrator}
- The password should contain at least 8 characters, 1 alphabetic character(s), 1 digit(s), 1 non-alphanumeric symbol(s)
Password :
Re-enter Password :
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]:
About to add user 'DCAdmin' for realm 'ManagementRealm'
Is this correct yes/no? yes
Added user 'DCAdmin' to file '/opt/wildfly-11.0.0.Final/standalone/configuration/mgmt-users.properties'
Added user 'DCAdmin' to file '/opt/wildfly-11.0.0.Final/domain/configuration/mgmt-users.properties'
Added user 'DCAdmin' with groups to file '/opt/wildfly-11.0.0.Final/standalone/configuration/mgmt-groups.properties'
Added user 'DCAdmin' with groups to file '/opt/wildfly-11.0.0.Final/domain/configuration/mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes
To represent the user add the following to the server-identities definition <secret value="cmVkaGF0QDEyMw==" />
Step 7) On HC1 edit /opt/wildfly-11.0.0.Final-Slave/domain/configuration/host.xml and add the <server-identity> and the <secret value="cmVkaGF0QDEyMw==" />which was generated in step 6 as follows:


<?xml version='1.0' encoding='UTF-8'?>

<host xmlns="urn:jboss:domain:5.0" name="DomSlave">
<extensions>
<extension module="org.jboss.as.jmx"/>
<extension module="org.wildfly.extension.core-management"/>
<extension module="org.wildfly.extension.elytron"/>
</extensions>
<management>
<security-realms>
<security-realm name="ManagementRealm">
<server-identities>
<secret value="cmVkaGF0QDEyMw==" />
</server-identities>
<authentication>

Step 8) Start the DC with the script in /opt/wildfly-11.0.0.Final-Master/bin as below. Make sure that there are no firewall restrictions so that 192.168.1.10:9999 is accessible from remote HC ( DomSlave in our scenario) .

$./domain.sh -Djboss.bind.address.management=192.168.1.10

Step 9) Start the HC1 (IP - 192.168.1.11) with the script in /opt/wildfly-11.0.0.Final-Slave/bin as below:

$./domain.sh -b 192.168.1.11
Step 10) Now you can see HC1 (DomSlave) Registered with the DC (DomMaster).


[Host Controller] 12:43:07,738 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 11.0.0.Final (WildFly Core 3.0.8.Final) (Host Controller) started in 7304ms - Started 77 of 79 services (23 services are lazy, passive or on-demand)
[Host Controller] 12:43:18,190 INFO [org.jboss.as.domain.controller] (Host Controller Service Threads - 32) WFLYHC0019: Registered remote slave host "DomSlave", JBoss WildFly Full 11.0.0.Final (WildFly 3.0.8.Final)
























Comments

Popular posts from this blog

How to configure a Datasource in JBoss / WildFly as a JAR Deployment

JDBC drivers can be installed as a JAR deployment using either the management CLI or the management console. As long as the driver is JDBC 4-compliant, it will automatically be recognized and installed as a JDBC driver upon deployment. 1. Download the appropriate JDBC driver from your database vendor. 2. Start the JBoss EAP/WildFly server. 3. Now most of the drivers coming with JDBC 4-compliant, but in case If the JDBC driver JAR is not JDBC 4-compliant, it can be made deployable using the following steps. i) Create a directory structure META-INF/services on your local system. $ mkdir -p META-INF/services    ii) Create a file inside META-INF/services/java.sql.Driver. $ touch META-INF/services/java.sql.Driver   iii) Add one line in the file to indicate the fully-qualified class name of the JDBC driver. $ echo “com.mysql.jdbc.Driver” > META-INF/services/java.sql.Driv...

Shift your Data into Virtualization

A single approach to data management that allows an application or user to retrieve and manipulate data without knowing any technical details about the data. That approach called Data Virtualization. Data Virtualization is different than traditional virtualization like - VMWare, Hypervisor, KVM, etc. because we already learned how to do virtualization of OS, Hardware and Storage, now time to add some more into virtualization, which is DATA. What is Data Virtualization? Data virtualization is a single window used to describe any approach to data management that allows an application to retrieve and manipulate data without requiring technical details about the data, such as how it is formatted, or where it is physically located. Why use Data Virtualization? Data virtualization promotes efficiency in data usage and processing and accelerates time to market on projects with complex data storage infrastructure. The purpose is to allow data to be accessed without creating extra ...

How to Install JBOSS EAP 7.0.0 on RHEL6.5/CentOS6.5 – a step by step tutorial of INSTALLER Installation

INTRODUCTION In this tutorial, we will demonstrate how to install and start a JBoss EAP 7.0.0 server on RHEL 6.5/CentOS 6.5. We use Oracle JDK 8 for this tutorial. This Tutorial Consists Of The Following Steps: Step 1: Download installer link Step 2: JDK installation and verification Step 3 to Step 14: JBoss EAP 7 installation procedure using INSTALLER Installation Step 15: Start Jboss EAP 7 server Red Hat JBoss EAP 7.0 is based on Wildfly 10 , and provides pre-configured options for features such as high-availability clustering, messaging, and distributed caching. And it is an application server that works as a middleware platform, is built on open standards, and is compliant with the Java EE 7 specification. Step 1: Download the installer from: https://developers.redhat.com/products/eap/download/ Select the EAP 7.0.0 (Developers version) from the list. Click on Installer option within Download column. For Linux/ Windows/Mac...