The application server domain can be managed from the Web admin console or as well using the Command Line Interface. In this tutorial we will show how to operate on the Command Line Interface to perform basic management operations.

How to manage WildFly JBoss EAP Domain Servers

The default state of the Servers is dictated by the configuration of the Host Controller, where it’s specified is a Server requires auto-start.

Once the Host Controller is active, you can however manage the state of Server easily through the Command Line Interface. Let’s see how to peform the basic maintenance operations.

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

/host=host1/server-config=server-one:stop()
"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 Stopped Server you can use the equivalent start() command:

/host=host1/server-config=server-one:start()
{
"outcome" => "success",
"result" => "STOPPING"
}

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

Since WildFly 9 / EAP 7 it is possible to execute the suspend operation. When a server is suspended it will immediately stop accepting new requests, but wait for existing request to complete.

The required command to suspend a running Server is:

/host=host1/server-config=server-one:suspend

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:

/host=host1/server-config=server-one:resume

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:

/host=host1/server-config=server-five:add(group=main-server-group,socket-binding-port-offset=300)

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:

 /host=host1/server-config=server-five:stop
{
    "outcome" => "success",
    "result" => "STOPPING"
}
/host=host1/server-config=server-five:remove

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:

/server-group=main-server-group:start-servers

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

/server-group=main-server-group:stop-servers

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:

 /server-group=new-server-group:remove

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:

:start-servers
:stop-servers
:suspend-servers
:resume-servers

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

0
0
0
s2smodern

Related articles available on mastertheboss.com

JBoss MBeans POJO

JMX MBean services are the core building blocks of the JBoss Appl

How to a dump of JNDI tree with JMX console ?

#2 JBoss Howto. This is the recipe of the day

How to configure JBoss to bind to a different IP ?

  If you want to change the jboss.bind.address property use the 

How to shut down JBoss from remote ?

JBoss recipe of the day

How to create multiple instances of an Mbean?

  Supposing you need two instances of an MBean, let's say one fo

JBoss classloader issues

By default JBoss (prior to version 3.2) uses a flat class loading

W

i

l

d

F

l

y

 

c

h

e

a

t

s

h

e

e

t