Use the Management CLI to
start and stop servers, deploy and undeploy applications, configure system
settings, and perform other administrative tasks.
Launch the Management CLI
Run the EAP_HOME/bin/jboss-cli.sh file by entering the
following at a command line:
$ EAP_HOME/bin/jboss-cli.sh
Quit the Management CLI
From the Management CLI, enter the quit command:
[domain@localhost:9999 /] quit
Connect the CLI to the
Domain controller with the following operations:
[jbossas@middleware bin]$ ./jboss-cli.sh --connect
--controller=192.168.1.12:9999
check domain controller
status
[domain@192.168.1.12:9999 /]
/host=master:read-attribute(name=server-state)
{
"outcome" =>
"success",
"result" => running
}
The server is in state
running. That means the server is up and running without any outstanding
configuration changes. Other states are starting, reload-required,
restart-required, and stopping.
The state
reload-required indicates that the server is running but a reload of all
services is required in order to apply configuration changes.
The CLI operation
:reload forces the server to shutdown and start again all services. The JVM
itself will be not restarted.
The state
restart-required means that a JVM restart is required to apply the
configuration changes.
Slave(Host controller) status
[domain@192.168.1.12:9999
/] /host=slave01:read-attribute(name=server-state)
{
"outcome" =>
"success",
"result" => running
}
Restart the DC
[domain@192.168.1.12:9999
/] /host=master:shutdown(restart=true)
{
"outcome"
=> "success"
}
Stop Host controller (Slave)
[domain@192.168.1.12:9999
/] /host=slave01:shutdown
{
"outcome" =>
"success",
"result" => undefined
}
Stop specific application server on Host controller
[domain@192.168.1.12:9999
/] /host=slave01/server-config=GB_SERVER01:stop(server=true)
{
"outcome" =>
"success",
"result" =>
"STOPPING"
}
check specific application server on Host
controller
[domain@192.168.1.12:9999 /]
/host=slave01/server-config=GB_SERVER01:read-attribute(name=status)
{
"outcome" =>
"success",
"result" =>
"STARTED"
}
Deploy an application in standalone server
[standalone@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war
Undeploy an applicaiton in standalone server
[standalone@192.168.1.12:9999 /] undeploy usg.war
Disable the application but without removing it
[standalone@192.168.1.12:9999 /] undeploy usg.war --keep-content
Enable the already deployed application
[standalone@192.168.1.12:9999 /]deploy –name=usg.war
If you want to deploy an application but do not want to enabled then you can use the below command
[standalone@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war --disabled
Deploy an application on Domain
Deploy an application to all server groups
[domain@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war --all-server-groups
Undeploy an application from all server groups
[domain@192.168.1.12:9999 /] undeploy usg.war --all-relevant-server-groups
Undeploy from a particular server group
[domain@192.168.1.12:9999 /] undeploy usg.war --server-groups=main-server-group --keep-content
Deploy the same application to other server group
Now if the application is already been deployed to one server group and you want it to deploy the same application on the other server group you can do it using the below command.
[domain@192.168.1.12:9999 /] deploy --name=usg.war --server-groups=main-server-group
Deploy an application which is disabled
If you want to deploy an application but do not want to enabled then you can use the below command
[domain@192.168.1.12:9999 /]deploy /home/jbossas/Desktop/usg.war –disabled
Deploy an application in standalone server
[standalone@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war
Undeploy an applicaiton in standalone server
[standalone@192.168.1.12:9999 /] undeploy usg.war
Disable the application but without removing it
[standalone@192.168.1.12:9999 /] undeploy usg.war --keep-content
Enable the already deployed application
[standalone@192.168.1.12:9999 /]deploy –name=usg.war
If you want to deploy an application but do not want to enabled then you can use the below command
[standalone@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war --disabled
Deploy an application on Domain
Deploy an application to all server groups
[domain@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war --all-server-groups
Deploy an application on particular server group
[domain@192.168.1.12:9999 /] deploy /home/jbossas/Desktop/usg.war --server-groups=GB_server_group
Undeploy an application from all server groups
[domain@192.168.1.12:9999 /] undeploy usg.war --all-relevant-server-groups
Undeploy from a particular server group
[domain@192.168.1.12:9999 /] undeploy usg.war --server-groups=main-server-group --keep-content
Deploy the same application to other server group
Now if the application is already been deployed to one server group and you want it to deploy the same application on the other server group you can do it using the below command.
[domain@192.168.1.12:9999 /] deploy --name=usg.war --server-groups=main-server-group
Deploy an application which is disabled
If you want to deploy an application but do not want to enabled then you can use the below command
[domain@192.168.1.12:9999 /]deploy /home/jbossas/Desktop/usg.war –disabled
[domain@192.168.1.12:9999 /] deploy
/home/jbossas/Desktop/usg.war --server-groups=GB_server_group
'usg.war' already
exists in the deployment repository (use --force to replace the existing
content in the repository).
Note that a successful deploy does not produce any output to the CLI.
Stop all servers in server group
[domain@192.168.1.12:9999
/] /server-group=GB_server_group:stop-servers
Start all servers in server group
[domain@192.168.1.12:9999
/] /server-group=GB_server_group:start-servers
Restart all servers in server group
[domain@192.168.1.12:9999
/] /server-group=GB_server_group:restart-servers
Check application server details ::
[domain@192.168.1.12:9999 /]
/host=slave02/server-config=GB_server02:read-resource(include-runtime=true)
{
"outcome" =>
"success",
"result" => {
"auto-start" => true,
"cpu-affinity" =>
undefined,
"group" =>
"GB_server_group",
"name" =>
"GB_server02",
"priority" => undefined,
"socket-binding-group" =>
"full-sockets",
"socket-binding-port-offset"
=> 50,
"status" =>
"STARTED",
"interface" => undefined,
"jvm" => undefined,
"path" => undefined,
"system-property" => undefined
}
}
JVM Metrics
By default every JVM
process expose some MBeans with information about the JVM and the environment.
The MBeans with the ObjectName java.lang:type=* are also accessible via the
CLI. The following CLI command is an example to get information about the
memory usage.
[domain@192.168.1.12:9999 /]
/host=slave02/core-service=platform-mbean/type=memory:read-attribute(name=heap-memory-usage)
{
"outcome" =>
"success",
"result" => {
"init" => 67108864L,
"used" => 27134640L,
"committed" => 64880640L,
"max" => 518979584L
}
}
If you are
not so familiar with the CLI syntax, the CLI provides a GUI. The GUI of the CLI
can be started with the following command:
[jbossas@middleware
bin]$ ./jboss-cli.sh --connect --controller=192.168.1.12:9999 --gui
No comments:
Post a Comment