Configuring WildFly 9 from the CLI in offline mode

WildFly  has a new management mode for the Command Line Interface which allows varying your configuration without being connected to a WildFly instance.

This can be launched using the embed-server command. Here is the synopsis of the command:

   embed-server [--admin-only=true|false]
                [-c=config_file || --server=config=config_file]
                [--empty-config --remove-existing-config]
                [--jboss-home=rootdir]
                [--stdout=discard|echo]

Let’s say you want to vary the server configuration named standalone2.xml:

embed-server --server-config=standalone2.xml --std-out=echo

As you can see from the echo on the CLI, an embedded WildFly server will start, without binding any network interface, so you will not conflict with any running server.

You can check the status of the server by executing a simple “ls” on the application server root:

[standalone@embedded /] ls

core-service                 name=francesco-pc
deployment                   namespaces=[]
deployment-overlay           process-type=Server
extension                    product-name=WildFly Full
interface                    product-version=9.0.0.Beta2
path                         profile-name=undefined
socket-binding-group         release-codename=Kenny
subsystem                    release-version=1.0.0.Beta2
system-property              running-mode=ADMIN_ONLY
launch-type=EMBEDDED         schema-locations=[]
management-major-version=3   server-state=running
management-micro-version=0   suspend-state=RUNNING
management-minor-version=0

Try updating your configuration:

[standalone@embedded /] /subsystem=ejb3/thread-pool=default:write-attribute(name=max-threads,value=99)

Now check your server configuration XML file which has been updated accordingly.

Please note that the Offline mode enables you to start with an empty configuration file, which will be therefore created from scratch:

[disconnected /] embed-server --server-config=my-config.xml --empty-config

In order to stop the embedded server you can simply type:

[standalone@embedded /] stop-embedded-server
[disconnected /]

References: https://developer.jboss.org/docs/DOC-53050

Exit mobile version