How to manage Servers in a WildFly Domain

This article will teach you how to manage the Servers and Server Groups running in a WildFly Domain. For the purpose of this article we will use the Command Line Interface to perform the management operations.

Pre-requisites: You should be able to set up WildFly in Domain mode. The following article will teach you how to configure it: How to configure WildFly in Domain mode

How to start and stop Domain Servers

You can configure the start up state of the Servers in the host.xml file, which contains the list of servers. The parameter is auto-start. If you don’t include the parameter, by default all Servers will start:

<servers directory-grouping="by-server">
    <server name="server-one" group="main-server-group">
        <socket-bindings port-offset="100"/>
    <server name="server-two" group="other-server-group">
        <socket-bindings port-offset="200"/>

In order to stop a Server, you need to operate on the server path of the Host Controller:

"outcome" => "success",
"result" => "STOPPING"

TIP: You force stopping a Server by using the kill() command which sends a kill -9 signal to interrupt abruptly the Server.

In order to start a Server you can use the equivalent start() command:

"outcome" => "success",
"result" => "STOPPING"

TIP: You can perform a stop and start in a single operation using the restart command.

Then, you can also execute the suspend operation. When you suspend a server, it will immediately stop accepting new requests, but wait for existing request to complete. For example, here is how to suspend the server-one:


TIP: It is a good idea to use suspend before shutting down a Server to enable the server to gracefully finish processing all active requests and then shut down.

On the other hand, you can resume a suspended Server as follows:

IMPORTANT: Please note that older WildFly versions used the server-config path to manage servers start and stop. This is now deprecated and will be removed in future server versions. Use the server path to manage your servers instead.

Adding or removing WildFly Servers to a Domain

In order to add a new Server, we need to point the Host Controller which will contain the new Server and define at least the Server Group it belongs. To avoid conflicts, it is recommended to define in the same context, the socket-binding-port-offset:


You can check the list of servers by stepping into the Host Controller’s path and executing an “ls” of the server element as follows:

cd /host=host1
ls server
server-five   server-one    server-two 

Conversely, you can remove a Server by using the remove command. The server needs however to be stopped before it can be removed:

    "outcome" => "success",
    "result" => "STOPPING"

How to manage WildFly Server Groups

As we have discussed for the single Servers, it is possible to perform the same operations (start/stop/suspend/resume/kill) also on the Server Groups. The advantage is that the operations will be performed on all Servers belonging to a Server Group.

For example, in order to start all Servers belonging to the man-server-group, you can execute the following command on our Domain:


The opposite operation (stop) can be executed as follows:


In order to add a new Server group, you can execute the add operation against the /server-group top element as follows. The mandatory attributes are the Server Group’s profile and its Socket Binding Group:

/server-group=new-server-group:add(profile=full, socket-binding-group=full-sockets)
    "outcome" => "success",
    "result" => undefined,
    "server-groups" => undefined

Remove the Server Group as follows:


Performing Domain-wide start/stop

An useful shortcut to start, stop or resume all Servers in a Domain is to start with a colon (“:”) which will trigger the following commands:


: You can also set a timeout on each operation, by including the timeout=x parameter between parenthesis