Configuring a JBoss AS Domain
Recommended by 0 users
As we will see, the configuration of single modules or subsystems does not vary from standalone to domain configuration; rather, what we need to learn is the domain controller and host controller configurations, which are responsible for handling and coordinating the lifecycle of application server instances.
So, these are the topics we are going to cover in this turorial:
- Introduction to JBoss AS domain
- How to configure the domain components
- What is the criteria for choosing a domain or a standalone
Introducing the JBoss AS domain
The concept of domain may be, initially, perceived as a little difficult to understand. The reason for this is that in Java EE paradigm, one is used to dealing with servers rather than domains. This is especially true with developers.
Basically, a domain is an administrative unit. It’s a perimeter within which all JBoss AS servers are managed by a domain controller.
From the process point of view, a domain is made up of four elements:
1. Domain controller: The domain controller is the management control point of your domain. An AS instance running in domain mode will have at most one process instance acting as a domain controller. The domain controller holds a centralized configuration, which is shared by the node instances belonging to the domain.
2. Host controller: It’s a process that is responsible for coordinating with a domain controller the lifecycle of server processes and the distribution of deployments, from the domain controller to the server instances.
3. Process controller: It’s a very lightweight process whose primary function is to spawn server processes and host controller processes, and manage their input/output streams. This also allows the host controller to be patched and restarted without impacting the associated servers.
4. Application server nodes: These are regular Java processes that map to instances of the application server. Each server node, in turn, belongs to a domain group. Domain groups are explained in detail when we discuss the domain configuration file.
In order to understand how to configure these components, we will first look at the basic domain configuration, which is built-in with the application server
Understanding the default domain configuration
Out of the box, the domain configuration includes a basic configuration made up of the following elements:
- One process controller that starts the other JVM processes.
- One host controller that acts as domain controller.
- Three server nodes. The first two are part of the main server group, and the third one (inactive) is part of the other server group.
The following image reinforces these concepts:
If you want to see this configuration from the JVM point of view, then you can use the VisualVM utility to have a look at the low-level details of your domain. As depicted by the following screenshot, four JVM processes are spawned. At first, the process controller is started, which in turn launches the host controller process and the two server nodes.
VisualVM is a Java Virtual Machine monitoring tool, which is included in the default J2SE distribution. You can find it in your JAVA_HOME/bin folder. Simply launch either jvisualvm.exe (Windows) or jvisualvm (Linux), depending on your operating system.
What is relevant to see from this screenshot is that with the basic domain setup, the host controller is also acting as domain controller; that is, it will hold the centralized configuration of the domain. This means that the host controller and domain controller will share the same JVM process. You can have proof of it by checking which is the operating system’s process ID that is bound to port 9999 (one port used by the domain controller).
On a Windows machine you would execute:
C:\Users\Admin>netstat -ao | find “9999” TCP 127.0.0.1:9999 CP11-010:0 LISTENING 6312 Looking up to the VisualVM process table, you can see that this process ID (6312) matches with the org.jboss.as.host-controller process.
Having completed a basic introduction to the application server domain, we will now cover all the details concerning its configuration.
Starting up and stopping a domain
Starting up a JBoss AS domain is simply a matter of launching the JBoss_HOME\bin\domain.bat or JBoss_HOME\bin\domain.sh script file, which is part of the server distribution. In a matter of seconds, your domain will be up and running:
In order to stop the application server domain, you can use the command-line client and issue the shutdown command on the host controller:
Unix/Linux users will issue:
./jboss-admin.sh –connect command=/host=master:shutdown Windows users will issue:
jboss-admin.bat –connect command=/host=master:shutdown
The default host name is master and it’s defined in the file host.xml, which is located in the JBOSS_HOME\domain\configuration folder. We will learn more about it in the next section.
Once the domain has started, some logfiles will be created. The host controller activity will be traced at JBOSS_HOME\domain\log\host-controller, while the process controller logs are located in the folder JBOSS_HOME\domain\log\process-controller.