Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

Chapter 9. How to…​

The following CLI commands and operations provide basic examples on how to accomplish certain tasks. For detailed instructions, see the appropriate section of the Configuration Guide or other JBoss EAP guide.

Unless specified otherwise, the examples apply when running as a standalone server. Use the --help argument on a command to get usage for that command. Use the read-operation-description to get information on a particular operation for a resource.

9.1. Add a Datasource

data-source add --name=DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME  --connection-url=CONNECTION_URL

9.2. Add a JMS Queue

jms-queue add --queue-address=QUEUE --entries=java:/jms/queue/QUEUE

9.3. Add a JMS Topic

jms-topic add --topic-address=TOPIC --entries=java:/jms/topic/TOPIC

9.4. Add a Module

module add --name=MODULE_NAME --resources=PATH_TO_RESOURCE --dependencies=DEPENDENCIES
Important

Using the module management CLI command to add and remove modules is provided as technology preview only. This command is not appropriate for use in a managed domain or when connecting to the management CLI remotely. Modules should be added and removed manually in a production environment. For more information, see the Create a Custom Module Manually and Remove a Custom Module Manually sections of the JBoss EAP Configuration Guide.

9.5. Add a Server

Add a new server to a host in a managed domain.

/host=HOST_NAME/server-config=SERVER_NAME:add(group=SERVER_GROUP_NAME)

9.6. Add a Server Group

Add a new server group in a managed domain.

/server-group=SERVER_GROUP_NAME:add(profile=PROFILE_NAME, socket-binding-group=SOCKET_BINDING_GROUP_NAME)

9.7. Add a System Property

/system-property=PROPERTY_NAME:add(value=PROPERTY_VALUE)

9.8. Clone a Profile

Clone a profile in a managed domain.

/profile=PROFILE_TO_CLONE:clone(to-profile=NEW_PROFILE_NAME)

9.9. Create a Hierarchical Profile

Create a new profile that inherits from other profiles.

/profile=NEW_PROFILE_NAME:add(includes=[PROFILE_1,PROFILE_2])

9.10. Deploy an Application to a Managed Domain

Deploy an Application to All Server Groups.

deploy /path/to/DEPLOYMENT.war --all-server-groups

Deploy an Application to One or More Server Groups.

deploy /path/to/DEPLOYMENT.war --server-groups=SERVER_GROUP_1,SERVER_GROUP_2

9.11. Deploy an Application to a Standalone Server

deploy /path/to/DEPLOYMENT.war

9.12. Display the Active User

Command:

:whoami

Output:

{
    "outcome" => "success",
    "result" => {"identity" => {
        "username" => "$local",
        "realm" => "ManagementRealm"
    }}
}

9.13. Display Schema Information

To show the schema information for the :product-info command:

:read-operation-description(name=product-info)

To display the schema version, execute an ls command at the management CLI root and look for the management-*-version values:

...
management-major-version=4
management-micro-version=0
management-minor-version=1
...

9.14. Display System and Server Information

Command:

:product-info

Output:

{
    "outcome" => "success",
    "result" => [{"summary" => {
        "host-name" => "HOST_NAME",
        "instance-identifier" => "INSTANCE_ID",
        "product-name" => "JBoss EAP",
        "product-version" => "7.0.0.GA",
        "product-community-identifier" => "Product",
        "product-home" => "EAP_HOME",
        "standalone-or-domain-identifier" => "OPERATING_MODE",
        "host-operating-system" => "OS_NAME",
        "host-cpu" => {
            "host-cpu-arch" => "CPU_ARCH",
            "host-core-count" => CORE_COUNT
        },
        "jvm" => {
            "name" => "JAVA_VM_NAME",
            "java-version" => "JAVA_VERSION",
            "jvm-version" => "JAVA_VM_VERSION",
            "jvm-vendor" => "JAVA_VM_VENDOR",
            "java-home" => "JAVA_HOME"
        }
    }}]
}

Similarly, for a managed domain, you can display the information for a particular JBoss EAP host or server:

/host=HOST_NAME:product-info
/host=HOST_NAME/server=SERVER_NAME:product-info

9.15. Reload a Host Controller

reload --host=HOST_NAME

9.16. Reload a Host Controller in Admin-only Mode

reload --host=HOST_NAME --admin-only=true

9.17. Reload the Server

reload

9.18. Reload the Server in Admin-Only Mode

reload --admin-only=true

9.19. Remove a Module

module remove --name=MODULE_NAME
Important

Using the module management CLI command to add and remove modules is provided as technology preview only. This command is not appropriate for use in a managed domain or when connecting to the management CLI remotely. Modules should be added and removed manually in a production environment. For more information, see the Create a Custom Module Manually and Remove a Custom Module Manually sections of the JBoss EAP Configuration Guide.

9.20. Shut Down a Host Controller

Shut down a host controller in a managed domain.

shutdown --host=HOST_NAME

9.21. Shut Down the Server

Shut down a standalone server.

shutdown

9.22. Start a Server

Start a server in a managed domain.

/host=HOST_NAME/server-config=SERVER_NAME:start

9.23. Start All Servers in a Server Group

Start all servers in a certain server group in a managed domain.

/server-group=SERVER_GROUP_NAME:start-servers

9.24. Stop a Server

Stop a server in a managed domain.

/host=HOST_NAME/server-config=SERVER_NAME:stop

9.25. Stop All Servers in a Server Group

Stop all servers in a certain server group in a managed domain.

/server-group=SERVER_GROUP_NAME:stop-servers

9.26. Take a Configuration Snapshot

Take a snapshot of the current configurations.

:take-snapshot

9.27. Undeploy an Application from a Managed Domain

Undeploy an application from all server groups with that deployment.

undeploy DEPLOYMENT.war --all-relevant-server-groups

Undeploy an application from a specific server group. The --keep-content parameter is required in order to keep the content in the repository for other server groups with that deployment.

undeploy DEPLOYMENT.war --server-groups=SERVER_GROUP_NAME --keep-content

9.28. Undeploy an Application from a Standalone Server

undeploy DEPLOYMENT.war

9.29. Update a Host Name

Update the name of a host in a managed domain. The host must be reloaded in order for the changes to take effect.

/host=EXISTING_HOST_NAME:write-attribute(name=name,value=NEW_HOST_NAME)
reload --host=EXISTING_HOST_NAME

9.30. View a Server Log

/subsystem=logging/log-file=SERVER_LOG_NAME:read-log-file