
Stopping and starting server groups via the Web Console
In this recipe, we will learn how to stop and start an entire server group using the Web Console. Since a server can belong to more than one server group, you might want to stop or start all servers at once, and thus stop or start the server group.
Getting ready
To be able to follow this recipe, we need to have completed the previous one. Thus, before we can begin, we need to start the master server and the slaves slave-1
and slave-2
. In three different terminals, navigate to the $WILDFLY_HOME
, and run the following commands:
$ ./bin/domain.sh -Djboss.domain.base.dir=master
../bin/domain.sh -Djboss.domain.base.dir=slave-1 -Djboss.domain.master.address=127.0.0.1
../bin/domain.sh -Djboss.domain.base.dir=slave-2 -Djboss.domain.master.address=127.0.0.1
.
Now that everything is up and running, let's move ahead.
How to do it…
- Open your browser and point it to the Admin Console:
http://localhost:9990
. - Enter the username and password (
wildfly
andcookbook.2015
respectively) and go to the Domain tab. You should see a page similar to the following screenshot:Admin Console—domain overview
- Now, on hovering the mouse over the Groups box, the command links will appear as follows:
Server Group: Start, Stop and Restart
- Also, hovering on a server-box, the command links will appear as follows:
Start server group
- Now try hitting the Stop Group command link and confirm the operation!
- Tadaaaa… pretty easy huh! The page updates the server instance icon and displays Operation successful in the message board:
Stopping Server Group
- In the log, you should see entries similar to the following:
[Host Controller] 09:05:52,656 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 9) WFLYHC0024: Stopping server REST-server-one [Server:REST-server-one] 09:05:52,692 INFO [org.jboss.as.server] (ServerService Thread Pool -- 59) WFLYSRV0211: Suspending server 09:05:52,706 INFO [org.jboss.as.process.Server:REST-server-one.status] (ProcessController-threads - 4) WFLYPC0019: Stopping process 'Server:REST-server-one' [Server:REST-server-one] 09:05:52,714 INFO [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been requested. [Server:REST-server-one] 09:05:52,732 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-13) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS] [Server:REST-server-one] 09:05:52,735 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-9) WFLYJCA0019: Stopped Driver service with driver-name = h2 [Server:REST-server-one] 09:05:52,736 INFO [org.wildfly.extension.undertow] (MSC service thread 1-16) WFLYUT0019: Host default-host stopping [Server:REST-server-one] 09:05:52,745 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0008: Undertow HTTP listener default suspending [Server:REST-server-one] 09:05:52,750 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0007: Undertow HTTP listener default stopped, was bound to /127.0.0.1:8080 [Server:REST-server-one] 09:05:52,752 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0004: Undertow 1.2.0.Beta10 stopping [Host Controller] 09:05:52,783 INFO [org.jboss.as.host.controller] (Remoting "slave-1:MANAGEMENT" task-11) WFLYHC0027: Unregistering server REST-server-one [Server:REST-server-one] 09:05:52,853 INFO [org.jboss.as] (MSC service thread 1-4) WFLYSRV0050: WildFly Full 9.0.0.Beta2 (WildFly Core 1.0.0.Beta2) stopped in 112ms [Server:REST-server-one] 09:05:52,902 INFO [org.jboss.as.process.Server:REST-server-one.status] (reaper for Server:REST-server-one) WFLYPC0011: Process 'Server:REST-server-one' finished with an exit status of 0 [Host Controller] 09:05:52,941 INFO [org.jboss.as.host.controller] (ProcessControllerConnection-thread - 2) WFLYHC0027: Unregistering server REST-server-one
- Let's restart the server group, by hitting the Start Group command link, as follows:
- Once restarted, WildFly confirms the successful operation by providing you with a message feedback and by updating the status icon associated to the servers belonging to the server group, as follows:
Start Sever Group
- The entries in the log of
slave-1
are as follows:[Host Controller] 09:08:46,327 INFO [org.jboss.as.host.controller] (Host Controller Service Threads - 13) WFLYHC0023: Starting server REST-server-one 09:08:46,404 INFO [org.jboss.as.process.Server:REST-server-one.status] (ProcessController-threads - 5) WFLYPC0018: Starting process 'Server:REST-server-one' [Server:REST-server-one] 09:08:46,859 INFO [org.jboss.modules] (main) JBoss Modules version 1.4.2.Final [Server:REST-server-one] 09:08:47,135 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.4.Final [Server:REST-server-one] 09:08:47,243 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: WildFly Full 9.0.0.Beta2 (WildFly Core 1.0.0.Beta2) starting [Server:REST-server-one] 09:08:47,347 INFO [org.xnio] (MSC service thread 1-4) XNIO version 3.3.0.Final [Server:REST-server-one] 09:08:47,356 INFO [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.3.0.Final [Server:REST-server-one] 09:08:47,383 INFO [org.jboss.remoting] (MSC service thread 1-4) JBoss Remoting version 4.0.8.Final [Host Controller] 09:08:48,065 INFO [org.jboss.as.domain.controller.mgmt] (Remoting "slave-1:MANAGEMENT" task-13) WFLYHC0021: Server [Server:REST-server-one] connected using connection [Channel ID 312ade53 (inbound) of Remoting connection 277898d9 to /127.0.0.1:34603] [Host Controller] 09:08:48,103 INFO [org.jboss.as.host.controller] (server-registration-threads - 1) WFLYHC0020: Registering server REST-server-one [Server:REST-server-one] 09:08:48,749 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 28) WFLYCTL0028: Attribute enabled is deprecated, and it might be removed in future version! [Server:REST-server-one] 09:08:48,845 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 33) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique. [Server:REST-server-one] 09:08:48,845 INFO [org.jboss.as.security] (ServerService Thread Pool -- 35) WFLYSEC0002: Activating Security Subsystem [Server:REST-server-one] 09:08:48,846 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 19) WFLYWS0002: Activating WebServices Extension [Server:REST-server-one] 09:08:48,850 INFO [org.jboss.as.security] (MSC service thread 1-15) WFLYSEC0001: Current PicketBox version=4.9.0.Beta2 [Server:REST-server-one] 09:08:49,427 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 49) WFLYCLINF0001: Activating Infinispan subsystem. [Server:REST-server-one] 09:08:49,434 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) WFLYNAM0001: Activating Naming Subsystem [Server:REST-server-one] 09:08:49,443 INFO [org.jboss.as.connector] (MSC service thread 1-13) WFLYJCA0009: Starting JCA Subsystem (IronJacamar 1.2.3.Final) [Server:REST-server-one] 09:08:49,464 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 43) WFLYJSF0007: Activated the following JSF Implementations: [main] [Server:REST-server-one] 09:08:49,498 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 50) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors [Server:REST-server-one] 09:08:49,537 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 32) WFLYUT0003: Undertow 1.2.0.Beta10 starting [Server:REST-server-one] 09:08:49,537 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) WFLYUT0003: Undertow 1.2.0.Beta10 starting [Server:REST-server-one] 09:08:49,550 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 53) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) [Server:REST-server-one] 09:08:49,566 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: Started Driver service with driver-name = h2 [Server:REST-server-one] 09:08:49,686 INFO [org.jboss.as.naming] (MSC service thread 1-15) WFLYNAM0003: Starting Naming Service [Server:REST-server-one] 09:08:49,698 INFO [org.jboss.as.mail.extension] (MSC service thread 1-7) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default] [Server:REST-server-one] 09:08:49,777 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 32) WFLYUT0014: Creating file handler for path /home/wildfly/WFC/wildfly/welcome-content [Server:REST-server-one] 09:08:49,916 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: Started server default-server. [Server:REST-server-one] 09:08:49,933 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0018: Host default-host starting [Server:REST-server-one] 09:08:50,029 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTP listener default listening on /127.0.0.1:8080 [Server:REST-server-one] 09:08:50,170 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-16) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS] [Server:REST-server-one] 09:08:50,440 INFO [org.jboss.ws.common.management] (MSC service thread 1-10) JBWS022052: Starting JBoss Web Services - Stack CXF Server 5.0.0.Beta3 [Server:REST-server-one] 09:08:50,733 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 9.0.0.Beta2 (WildFly Core 1.0.0.Beta2) started in 4228ms - Started 193 of 370 services (207 services are lazy, passive or on-demand)
There's more...
The same operations apply while stopping and starting a single server instance.
In the host.xml
file you can define the auto-start
attribute, the default value of which is true
. Setting it to false
will not start the server, and you will have to start it manually via the Admin Console or via CLI.
<server name="REST-server-one" group="server-group-REST-app" auto-start="true"> <jvm name="default"> <heap size="64m" max-size="256m"/> </jvm> </server>
In this regard, let's try the CLI which is more fascinating!