Bookmark this page

Configuring Servers

Objectives

  • Configure a server within a host controller.

  • Identify the different attributes of a server configuration that are configured in the host.xml file of the host controller.

  • Identify the different options available to create and manage servers in a managed domain.

  • Define how to shut down servers, server groups and the entire managed domain from the management CLI.

Servers Definition

A server is a logical runtime instance of Red Hat JBoss Enterprise Application Platform (JBoss EAP) running within a managed domain. A server belongs to a server group, even if the group only contains a single server. Individual servers are managed by the respective host controllers. The host controllers communicate with the domain controller, and ensure that all the servers within a managed domain have the same configuration.

Each server belongs to a unique server group and runs within a host. A host can run multiple servers simultaneously by using the JBoss EAP provided concept of a port offset to ensure that there are no network port or socket clashes at runtime.

Servers are configured in the host.xml file on the individual host controllers, which run on a physical or virtual machine.

Server Configuration

Servers in a managed domain are defined in the <servers> section of host.xml on each host controller. You can use the child element <server> within the <servers> parent element to define a server. For example:

  <servers>
    <server name="serverA" group="main-server-group"> 1 2
        <socket-bindings socket-binding-group="standard-sockets"/> 3
    </server>
    <server name="serverB" group="other-server-group" auto-start="true"> 4
        <jvm name="default">5
           ...
        </jvm>
        <socket-bindings socket-binding-group="standard-sockets" port-offset="350"> 6
    </server>
</servers>

1

The name attribute is required and is the name of the server. It must be unique within the host.

2

The group attribute is required and must reference a valid server group name defined previously in domain.xml.

3

The socket-binding-group attribute references a valid socket-binding-group value defined in domain.xml.

4

The auto-start attribute defaults to true and causes the server to automatically start when the host controller is started or restarted. You can set this attribute to false to disable server auto-start on the host. If you set the attribute to false, then you need to manually start the server.

5

The <jvm> element configures the JVM settings for the server. Any values defined here within the <server> element override the jvm settings from either the host or server group level. JVM memory allocation in JBoss EAP is discussed elsewhere in the course.

6

The port-offset value is used to avoid network port clashes when multiple servers are defined on the same machine. In this case, serverB runs with an offset value of 350 from the base value defined for this profile. For example, on this host, the public HTTP interface listens on port 8080 for the serverA instance because it has no port-offset defined. The serverB instance public HTTP interface listens on port 8430.

Note

A host can have any number of servers. To avoid port conflicts, use the port-offset attribute of the <socket-bindings> elements in the domain.xml file.

Note

Notice that the <server> element does not contain any information about deployed applications. All deployments for a server are configured at the server group level in the domain.xml configuration file.

Managing Servers by Using the Management Console

You can create the servers in a managed domain in the Hosts section under the Runtime tab of the management console.

Figure 5.11: Runtime view

To add a new server, you must provide the following three key attributes:

  • A unique Name for the server

  • A valid server group from the list of server groups defined in the domain.xml configuration file

  • A port offset value in case there are multiple servers running on the same host

Figure 5.12: Creating a new server

To remove a server from a host, ensure that the server is stopped.

Figure 5.13: Server options - Remove

Individual servers can be started, stopped, restarted, reloaded, and suspended by clicking View drop-down menu next to the server in the Hosts section under the Runtime tab of the management console.

Configuring and Managing Servers by Using the Management CLI

You can create and manage servers by using the JBoss EAP management CLI. The advantage of this approach is that the steps to create and manage the servers can be scripted as part of an automated workflow and it is faster to create multiple servers in batched mode. This approach also has the option of atomically committing or rolling back multiple steps in batch mode, thereby ensuring the integrity of the host.xml configuration file in case of an error during execution of the CLI commands.

You configure the servers in the /host namespace of a managed domain. There are commands to create, view, start, stop, restart, reload, suspend, and remove servers under this namespace. To add a new server, run the following command:

[domain@workstation:9990 /] /host=host2/server-config=serverA:add\
(auto-start=true,group=Group1,socket-binding-port-offset=100)
{
    "outcome" => "success",
    "result" => {
        ....
    }
}

To start a single server, run the following command:

[domain@workstation:9990 /] /host=host2/server-config=serverA:start
{
    "outcome" => "success",
    "result" => "STARTING"
}

To stop a single server, run the following command:

[domain@workstation:9990 /] /host=host2/server-config=serverA:stop
{
    "outcome" => "success",
    "result" => "STOPPING"
}

All the servers in a server group can be started by running the following command:

[domain@workstation:9990 /] /server-group=Group1:start-servers(blocking=true)
{
    "outcome" => "success",
    ...
}

Similarly, to stop all the servers in a server group, run the following command:

[domain@workstation:9990 /] /server-group=Group1:stop-servers(blocking=true)
{
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined
}

Note

The blocking=true property ensures that the control returns to the management CLI prompt only after all servers in the server group start or stop successfully. If the value is false, then the control returns immediately to the management CLI prompt, and the servers start or stop asynchronously in the background.

To remove a server, you must first ensure that the server is stopped. To remove the server, run the following command:

[domain@workstation:9990 /] /host=host2/server-config=serverA:remove()
{
    "outcome" => "success",
    ...
}

In JBoss EAP, you can suspend a server by using the suspend operation. Any server in a suspended mode does not accept new requests from any client until the server is resumed. A suspended server can begin serving requests immediately by running the resume operation.

You can use the graceful shut down operation. A graceful shut down is different from an ordinary shut down because the server is suspended before shutting down. To invoke this behavior you must pass a timeout parameter to the shutdown, stop, or stop-servers operations. The server waits until the timeout for all requests is finished before shutting down.

You can also gracefully shut down a host controller from the management CLI. To shutdown a host controller, first ensure that all the servers running on this host are stopped and then run the following command:

[domain@workstation:9990 /] /host=host2:shutdown(timeout=1000)
{
    "outcome" => "success",
    "result" => undefined
}

You can to gracefully shut down the domain controller from the management CLI. To shutdown a primary domain controller, run the following command:

[domain@workstation:9990 /] /host=primary:shutdown(timeout=1000)
{
{"outcome" => "success"}
[domain@localhost:9990 /]
The controller has closed the connection.
[disconnected /]
}

References

For more information about using the management CLI in domain mode, refer to the Using the Management CLI with a Managed Domain chapter in the Management CLI Guide in the Red Hat JBoss EAP documentation at https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.4/html-single/management_cli_guide/index#using_cli_domain

Revision: ad248-7.4-18a9db2