此内容没有您所选择的语言版本。

Chapter 11. 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, Configuring Messaging, or other JBoss EAP documentation.

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.

11.1. Add a Datasource

data-source add --name=DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME  --connection-url=CONNECTION_URL
Copy to Clipboard Toggle word wrap

11.2. Add an Extension

Example: Add a New Extension to a Configuration

/extension=EXTENSION_NAME:add
Copy to Clipboard Toggle word wrap

11.3. Add a JMS Queue

jms-queue add --queue-address=QUEUE_NAME --entries=JNDI_NAME
Copy to Clipboard Toggle word wrap

11.4. Add a JMS Topic

jms-topic add --topic-address=TOPIC_NAME --entries=JNDI_NAME
Copy to Clipboard Toggle word wrap

11.5. Add a Module

module add --name=MODULE_NAME --resources=PATH_TO_RESOURCE --dependencies=DEPENDENCIES
Copy to Clipboard Toggle word wrap
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.

Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features.

11.6. Add a Server

Example: Add a New Server to a Host in a Managed Domain

/host=HOST_NAME/server-config=SERVER_NAME:add(group=SERVER_GROUP_NAME)
Copy to Clipboard Toggle word wrap

11.7. Add a Server Group

Example: 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)
Copy to Clipboard Toggle word wrap

11.8. Add a System Property

/system-property=PROPERTY_NAME:add(value=PROPERTY_VALUE)
Copy to Clipboard Toggle word wrap

11.9. Clone a Profile

Example: Clone a Profile in a Managed Domain

/profile=PROFILE_TO_CLONE:clone(to-profile=NEW_PROFILE_NAME)
Copy to Clipboard Toggle word wrap

11.10. Create a Hierarchical Profile

Example: Create a New Profile That Inherits from Other Profiles

/profile=NEW_PROFILE_NAME:add(includes=[PROFILE_1,PROFILE_2])
Copy to Clipboard Toggle word wrap

11.11. Deploy an Application to a Managed Domain

Example: Deploy an Application to All Server Groups

deployment deploy-file /path/to/DEPLOYMENT.war --all-server-groups
Copy to Clipboard Toggle word wrap

Example: Deploy an Application to One or More Server Groups

deployment deploy-file /path/to/DEPLOYMENT.war --server-groups=SERVER_GROUP_1,SERVER_GROUP_2
Copy to Clipboard Toggle word wrap

11.12. Deploy an Application to a Standalone Server

deployment deploy-file /path/to/DEPLOYMENT.war
Copy to Clipboard Toggle word wrap

11.13. Disable All Applications

deployment disable /path/to/DEPLOYMENT.war
Copy to Clipboard Toggle word wrap

You can use the deployment disable-all command to disable all the deployments.

deployment disable-all
Copy to Clipboard Toggle word wrap

11.14. Display the Active User

Example: Command to Display the Current User

:whoami
Copy to Clipboard Toggle word wrap

Example: Output for the Current User

{
    "outcome" => "success",
    "result" => {"identity" => {
        "username" => "$local",
        "realm" => "ManagementRealm"
    }}
}
Copy to Clipboard Toggle word wrap

11.15. Display the Contents of an Attachment

You can use the attachment display command to display the contents of an attachment returned from a management operation. This applies to any management operation that returns the attached-streams response header.

For example, the following operation returns the server.log file attached as a stream.

/subsystem=logging/log-file=server.log:read-attribute(name=stream)
{
    "outcome" => "success",
    "result" => "f61a27c4-c5a7-43ac-af1f-29e90c9acb3e",
    "response-headers" => {"attached-streams" => [{
        "uuid" => "f61a27c4-c5a7-43ac-af1f-29e90c9acb3e",
        "mime-type" => "text/plain"
    }]}
}
Copy to Clipboard Toggle word wrap

You can use the attachment display command to display the contents of the stream returned form this operation to the console.

attachment display --operation=/subsystem=logging/log-file=server.log:read-attribute(name=stream)
Copy to Clipboard Toggle word wrap

This outputs the contents of the server.log file to the console.

ATTACHMENT 3480a327-31dd-4412-bdf3-f36c94ac4a09:
2018-10-18 09:19:37,082 INFO  [org.jboss.modules] (main) JBoss Modules version 1.8.6.Final-redhat-00001
2018-10-18 09:19:37,366 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.5.Final-redhat-00001
2018-10-18 09:19:37,380 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.2.Final-redhat-1
2018-10-18 09:19:37,510 INFO  [org.jboss.as] (MSC service thread 1-1) WFLYSRV0049: JBoss EAP 7.2.0.GA (WildFly Core 6.0.9.Final-redhat-20181015) starting
...
Copy to Clipboard Toggle word wrap

11.16. Display Schema Information

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

:read-operation-description(name=product-info)
Copy to Clipboard Toggle word wrap

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
...
Copy to Clipboard Toggle word wrap

11.17. Display System and Server Information

Example: Command to Display the System and Server Information

:product-info
Copy to Clipboard Toggle word wrap

Example: Output for the System and Server Information

{
    "outcome" => "success",
    "result" => [{"summary" => {
        "host-name" => "HOST_NAME",
        "instance-identifier" => "INSTANCE_ID",
        "product-name" => "JBoss EAP",
        "product-version" => "7.2.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"
        }
    }}]
}
Copy to Clipboard Toggle word wrap

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

/host=HOST_NAME:product-info
Copy to Clipboard Toggle word wrap
/host=HOST_NAME/server=SERVER_NAME:product-info
Copy to Clipboard Toggle word wrap

11.18. Enable All Disabled Deployments

deployment enable DEPLOYMENT.war
Copy to Clipboard Toggle word wrap

You can use the deployment enable-all command to enable all the deployments.

deployment enable-all --server-groups=other-server-group
Copy to Clipboard Toggle word wrap

11.19. Get the Command Timeout Value

Example: Display the CLI Command Timeout Value

command-timeout get
Copy to Clipboard Toggle word wrap

The value returned is in seconds. A value of 0 means no timeout.

11.20. Reload a Host Controller

reload --host=HOST_NAME
Copy to Clipboard Toggle word wrap

11.21. Reload a Host Controller in Admin-only Mode

reload --host=HOST_NAME --admin-only=true
Copy to Clipboard Toggle word wrap

11.22. Reload All Servers in a Server Group

Example: Reload All Servers in a Certain Server Group in a Managed Domain

/server-group=SERVER_GROUP_NAME:reload-servers
Copy to Clipboard Toggle word wrap

Note

To reload the servers in a suspended state, pass in the start-mode=suspend argument.

11.23. Reload a Server

Example: Reload a Server in a Managed Domain

/host=HOST_NAME/server-config=SERVER_NAME:reload
Copy to Clipboard Toggle word wrap

Note

To reload the server in a suspended state, pass in the start-mode=suspend argument.

11.24. Reload a Standalone Server

reload
Copy to Clipboard Toggle word wrap
Note

To reload the server in admin-only mode, pass in the --start-mode=admin-only argument. To reload the server in a suspended state, pass in the --start-mode=suspend argument.

11.25. Remove an Extension

Example: Remove an Existing Extension

/extension=EXTENSION_NAME:remove
Copy to Clipboard Toggle word wrap

11.26. Remove a Module

module remove --name=MODULE_NAME
Copy to Clipboard Toggle word wrap
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.

Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features.

11.27. Reset the Command Timeout Value

Example: Reset the Command Timeout to the Default Value

command-timeout reset default
Copy to Clipboard Toggle word wrap

Example: Reset the Command Timeout to the Value Provided by the CLI Configuration

command-timeout reset config
Copy to Clipboard Toggle word wrap

Note

The value provided by the CLI configuration can be set in either in the EAP_HOME/bin/jboss-cli.xml file or passed in with the --command-timeout argument when starting the management CLI.

11.28. Restart All Servers in a Server Group

Example: Restart All Servers in a Certain Server Group in a Managed Domain

/server-group=SERVER_GROUP_NAME:restart-servers
Copy to Clipboard Toggle word wrap

Note

To restart the servers in a suspended state, pass in the start-mode=suspend argument.

11.29. Restart a Server

Example: Restart a Server in a Managed Domain

/host=HOST_NAME/server-config=SERVER_NAME:restart
Copy to Clipboard Toggle word wrap

Note

To restart the server in a suspended state, pass in the start-mode=suspend argument.

11.30. Save the Contents of an Attachment

You can use the attachment save command to save the contents of an attachment returned from a management operation to a file. This applies to any management operation that returns the attached-streams response header.

For example, the following operation returns the server.log file attached as a stream.

/subsystem=logging/log-file=server.log:read-attribute(name=stream)
{
    "outcome" => "success",
    "result" => "f61a27c4-c5a7-43ac-af1f-29e90c9acb3e",
    "response-headers" => {"attached-streams" => [{
        "uuid" => "f61a27c4-c5a7-43ac-af1f-29e90c9acb3e",
        "mime-type" => "text/plain"
    }]}
}
Copy to Clipboard Toggle word wrap

You can use the attachment save command to save the contents of the stream returned form this operation to a file.

attachment save --operation=/subsystem=logging/log-file=server.log:read-attribute(name=stream) --file=log-output.txt
Copy to Clipboard Toggle word wrap

This saves the contents of the server.log file to EAP_HOME/bin/log-output.txt.

11.31. Set the Command Timeout Value

Example: Set the Maximum Time to Wait for a CLI Command to Complete

command-timeout set TIMEOUT_VALUE
Copy to Clipboard Toggle word wrap

The value is set in seconds. A value of 0 means no timeout.

11.32. Shut Down a Host Controller

Example: Shut Down a Host Controller in a Managed Domain

shutdown --host=HOST_NAME
Copy to Clipboard Toggle word wrap

11.33. Shut Down the Server

Example: Shut Down a Standalone Server

shutdown
Copy to Clipboard Toggle word wrap

11.34. Start All Servers in a Server Group

Example: Start All Servers in a Certain Server Group in a Managed Domain

/server-group=SERVER_GROUP_NAME:start-servers
Copy to Clipboard Toggle word wrap

Note

To start the servers in a suspended state, pass in the start-mode=suspend argument.

11.35. Start a Server

Example: Start a Server in a Managed Domain

/host=HOST_NAME/server-config=SERVER_NAME:start
Copy to Clipboard Toggle word wrap

Note

To start the server in a suspended state, pass in the start-mode=suspend argument.

11.36. Stop All Servers in a Server Group

Example: Stop All Servers in a Certain Server Group in a Managed Domain

/server-group=SERVER_GROUP_NAME:stop-servers
Copy to Clipboard Toggle word wrap

11.37. Stop a Server

Example: Stop a Server in a Managed Domain

/host=HOST_NAME/server-config=SERVER_NAME:stop
Copy to Clipboard Toggle word wrap

11.38. Take a Configuration Snapshot

Example: Take a Snapshot of the Current Configurations

:take-snapshot
Copy to Clipboard Toggle word wrap

11.39. Undeploy All Applications

Example: Undeploy All Applications from a Managed Domain

deployment undeploy * --all-relevant-server-groups
Copy to Clipboard Toggle word wrap

Example: Undeploy All Applications from a Standalone Domain

deployment undeploy *
Copy to Clipboard Toggle word wrap

11.40. Undeploy an Application from a Managed Domain

Example: Undeploy an Application from All Server Groups with That Deployment

deployment undeploy DEPLOYMENT.war --all-relevant-server-groups
Copy to Clipboard Toggle word wrap

Example: Undeploy an Application from a Specific Server Group

deployment undeploy DEPLOYMENT.war --server-groups=SERVER_GROUP_NAME
Copy to Clipboard Toggle word wrap

11.41. Undeploy an Application from a Standalone Server

deployment undeploy DEPLOYMENT.war
Copy to Clipboard Toggle word wrap

11.42. Update a Host Name

Example: Update the Name of a Host in a Managed Domain

/host=EXISTING_HOST_NAME:write-attribute(name=name,value=NEW_HOST_NAME)
reload --host=EXISTING_HOST_NAME
Copy to Clipboard Toggle word wrap

The host must be reloaded in order for the changes to take effect.

11.43. Upload an Attachment

You can upload a local file as an attachment to management operations that accept file streams. For example, the following management CLI command uses the input-stream-index option to upload the contents of a local file to an exploded deployment.

/deployment=DEPLOYMENT_NAME.war:add-content(content=[{target-path=/path/to/FILE_IN_DEPLOYMENT, input-stream-index=/path/to/LOCAL_FILE_TO_UPLOAD}]
Copy to Clipboard Toggle word wrap

For more details on uploading files to a deployment, see the Add Content to an Exploded Deployment section of the Configuration Guide.

11.44. View a Server Log

/subsystem=logging/log-file=SERVER_LOG_NAME:read-log-file
Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat