This article by Francesco Marchioni author of the book Mastering JBoss Enterprise Application Platform 7dives deep into application server management using the domain mode, its main components, and discusses how to shift to advanced configurations that resemble real-world projects. Here are the main topics covered are:
(For more resources related to this topic, see here.)
Managing the application server in the domain mode means, in a nutshell, to control multiple servers from a centralized single point of control. The servers that are part of the domain can span across multiple machines (or even across the cloud) and they can be grouped with similar servers of the domain to share a common configuration. To make some rationale, we will break down the domain components into two main categories:
When you start the application server through the domain.sh script, you will be able to identify the following processes:
If you start the default domain configuration on a Linux machine, you will see that the following processes will show in your operating system:
As you can see, the process controller is identified by the [Process Controller] label, while the domaincontroller corresponds to the [Host Controller] label. Each server shows in the process table with the name defined in the host.xml file. You can use common operating system commands such as grep to further restrict the search to a specific process.
A domain configuration with only physical elements in it would not add much to a line of standalone servers. The following components can abstract the domain definition, making it dynamic and flexible:
So far we have learnt the default configuration files used by JBoss EAP and the location where they are placed. These settings can be however varied by means of system properties. The following table shows how to customize the domain configuration file names:
Option | Description |
--domain-config | The domain configuration file (default domain.xml) |
--host-config | The host configuration file (default host.xml) |
On the other hand, this table summarizes the available options to adjust the domain directory structure:
Property | Description |
jboss.domain.base.dir | The base directory for domain content |
jboss.domain.config.dir | The base configuration directory |
jboss.domain.data.dir | The directory used for persistent data file storage |
jboss.domain.log.dir | The directory containing the host-controller.log and process-controller.log files |
jboss.domain.temp.dir | The directory used for temporary file storage |
jboss.domain.deployment.dir | The directory used to store deployed content |
jboss.domain.servers.dir | The directory containing the managed server instances |
For example, you can start EAP 7 in domain mode using the domain configuration file mydomain.xml and the host file named myhost.xml based on the base directory /home/jboss/eap7domain using the following command:
$ ./domain.sh –domain-config=mydomain.xml –host-config=myhost.xml –Djboss.domain.base.dir=/home/jboss/eap7domain
Before creating your first domain, we will learn more in detail the process which connects one or more host controller to one domaincontroller and how to elect a host controller to be a domaincontroller.
The physical topology of the domain is stored in the host.xml file. Within this file, you will find as the first line the Host Controller name, which makes each host controller unique:
<host name="master">
One of the host controllers will be configured to act as a domaincontroller. This is done in the domain-controller section with the following block, which states that the domaincontroller is the host controller itself (hence, local):
<domain-controller>
<local/>
</domain-controller>
All other host controllers will connect to the domaincontroller, using the following example configuration which uses the jboss.domain.master.address and jboss.domain.master.port properties to specify the domaincontroller address and port:
<domain-controller>
<remote protocol="remote"
host="${jboss.domain.master.address}"
port="${jboss.domain.master.port:9999}"
security-realm="ManagementRealm"/>
</domain-controller>
The host controller-domaincontroller communication happens behind the scenes through a management native port that is defined as well into the host.xml file:
<management-interfaces>
<native-interface security-realm="ManagementRealm">
<socket interface="management" port="${jboss.management.native.port:9999}"/>
</native-interface>
<http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
<socket interface="management" port="${jboss.management.http.port:9990}"/>
</http-interface>
</management-interfaces>
The other highlighted attribute is the managementhttpport that can be used by the administrator to reach the domaincontroller. This port is especially relevant if the host controller is the domaincontroller. Both sockets use the management interface, which is defined in the interfaces section of the host.xml file, and exposes the domain controller on a network available address:
<interfaces>
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
If you want to run multiplehost controllers on the same machine, you need to provide a unique jboss.management.native.port for each host controller or a different jboss.bind.address.management.
In this article we have some essentials of the domain mode breakdown, handy domain propertiesand also electing the domain controller.