CLI (COMMAND LINE INTERFACE)
The Command Line Interface (CLI) is a command line management tool for the JBOSS EAP/AS domain or a standalone server. It acts as a command line administration tool for JBOSS
CLI allows a user to connect to the JBOSS domain controller or a standalone server and execute management operations such as start and stop servers, monitor the mbean values, Deploy and undeploy the application code and many other administrative task.
CLI management tool is launched by calling script which comes along with JBOSS EAP package.
Package will be having both jboss-cli script for LINUX/UNIX and WINDOWS.
$EAP_HOME\bin\jboss-cli.sh - script to launch the management CLI for LINUX/UNIX $EAP_HOME\bin\jboss-cli.bat - script to launch the management CLI for WINDOWS
By using connect command we will be able to connect the running Jboss standalone server or managed domain.
We need to provide the host and port in which the server is listening along with the connect command.
To launch CLI and connect to the server in one step can be achieved by using –connect argument along with –controller argument for host and port specific.
- –connect (-c) – instructs the CLI to connect to the controller on start-up
(to avoid issuing a separate connect command later).
- –controller – the default controller host and port to connect to when
–connect option is specified or when the
connect command is issued w/o the arguments. The default
controller host is localhost and the port is 9999.
$ EAP_HOME/bin/jboss-cli.sh --connect --controller=192.168.0.1:9991
When management CLI is launched and connected, it will be at the root level(/).
To change in to different node path can be done using cd command along with the desired path.
Using pwd command we can see the full path of the current node.
ls command can be used to list the files
quit command can be used to quit the management CLI.
Below is the way to retrieve the server state
$EAP_HOME/bin/jboss-cli.sh --controller="192.67.601.21:1099" connect :read-attribute(name=server-state)