Reloading a server configuration via the CLI

In this recipe, we will learn how to reload the server configuration, without the need for a full restart. Often, there are changes that need the server to be reloaded. Most of the time you realize that a specific setting needs a different value just after a server startup or during tests. So, instead of stopping and starting the all application server, you can just reload the configuration, unless the change involves the JVM or settings that are needed at boot time.

Getting ready

We have already seen how to reload a server while playing with IPs and port binding, but it's worth mentioning again.

How to do it…

The command itself is pretty easy:

$ ./bin/jboss-cli.sh --connect
[standalone@localhost:9990 /] reload
[standalone@localhost:9990 /]

How it works…

Basically, the reload command issues, in sequence, a stop for all the WildFly active services and a start, which starts up the services again. This should give you important information. The JVM remains the same. If you test the active process at the OS level before and after issuing the reload command, you will notice that the processes' IDs are the same.

$ ps -efa | grep java | grep -v grep
luigi     4915  4879 80 16:07 pts/3    00:00:11 /home/luigi/WFC/jdk8/bin/java -D[Standalone] -server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/home/luigi/WFC/wildfly/standalone/log/server.log -Dlogging.configuration=file:/home/luigi/WFC/wildfly/standalone/configuration/logging.properties -jar /home/luigi/WFC/wildfly/jboss-modules.jar -mp /home/luigi/WFC/wildfly/modules org.jboss.as.standalone -Djboss.home.dir=/home/luigi/WFC/wildfly -Djboss.server.base.dir=/home/luigi/WFC/wildfly/standalone
luigi     5031  5023 36 16:07 pts/2    00:00:01 /home/luigi/WFC/jdk8/bin/java -Djboss.modules.system.pkgs=com.sun.java.swing -Dlogging.configuration=file:/home/luigi/WFC/wildfly/bin/jboss-cli-logging.properties -jar /home/luigi/WFC/wildfly/jboss-modules.jar -mp /home/luigi/WFC/wildfly/modules org.jboss.as.cli --connect

Last but not least, your CLI does not disconnect.