Este contenido no está disponible en el idioma seleccionado.
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 Copiar enlaceEnlace copiado en el portapapeles!
data-source add --name=DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME --connection-url=CONNECTION_URL
data-source add --name=DATASOURCE_NAME --jndi-name=JNDI_NAME --driver-name=DRIVER_NAME --connection-url=CONNECTION_URL
11.2. Add an Extension Copiar enlaceEnlace copiado en el portapapeles!
Example: Add a New Extension to a Configuration
/extension=EXTENSION_NAME:add
/extension=EXTENSION_NAME:add
11.3. Add a JMS Queue Copiar enlaceEnlace copiado en el portapapeles!
jms-queue add --queue-address=QUEUE_NAME --entries=JNDI_NAME
jms-queue add --queue-address=QUEUE_NAME --entries=JNDI_NAME
11.4. Add a JMS Topic Copiar enlaceEnlace copiado en el portapapeles!
jms-topic add --topic-address=TOPIC_NAME --entries=JNDI_NAME
jms-topic add --topic-address=TOPIC_NAME --entries=JNDI_NAME
11.5. Add a Module Copiar enlaceEnlace copiado en el portapapeles!
module add --name=MODULE_NAME --resources=PATH_TO_RESOURCE --dependencies=DEPENDENCIES
module add --name=MODULE_NAME --resources=PATH_TO_RESOURCE --dependencies=DEPENDENCIES
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 Copiar enlaceEnlace copiado en el portapapeles!
Example: Add a New Server to a Host in a Managed Domain
/host=HOST_NAME/server-config=SERVER_NAME:add(group=SERVER_GROUP_NAME)
/host=HOST_NAME/server-config=SERVER_NAME:add(group=SERVER_GROUP_NAME)
11.7. Add a Server Group Copiar enlaceEnlace copiado en el portapapeles!
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)
/server-group=SERVER_GROUP_NAME:add(profile=PROFILE_NAME, socket-binding-group=SOCKET_BINDING_GROUP_NAME)
11.8. Add a System Property Copiar enlaceEnlace copiado en el portapapeles!
/system-property=PROPERTY_NAME:add(value=PROPERTY_VALUE)
/system-property=PROPERTY_NAME:add(value=PROPERTY_VALUE)
11.9. Clone a Profile Copiar enlaceEnlace copiado en el portapapeles!
Example: Clone a Profile in a Managed Domain
/profile=PROFILE_TO_CLONE:clone(to-profile=NEW_PROFILE_NAME)
/profile=PROFILE_TO_CLONE:clone(to-profile=NEW_PROFILE_NAME)
11.10. Create a Hierarchical Profile Copiar enlaceEnlace copiado en el portapapeles!
Example: Create a New Profile That Inherits from Other Profiles
/profile=NEW_PROFILE_NAME:add(includes=[PROFILE_1,PROFILE_2])
/profile=NEW_PROFILE_NAME:add(includes=[PROFILE_1,PROFILE_2])
11.11. Deploy an Application to a Managed Domain Copiar enlaceEnlace copiado en el portapapeles!
Example: Deploy an Application to All Server Groups
deployment deploy-file /path/to/DEPLOYMENT.war --all-server-groups
deployment deploy-file /path/to/DEPLOYMENT.war --all-server-groups
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
deployment deploy-file /path/to/DEPLOYMENT.war --server-groups=SERVER_GROUP_1,SERVER_GROUP_2
11.12. Deploy an Application to a Standalone Server Copiar enlaceEnlace copiado en el portapapeles!
deployment deploy-file /path/to/DEPLOYMENT.war
deployment deploy-file /path/to/DEPLOYMENT.war
11.13. Disable All Applications Copiar enlaceEnlace copiado en el portapapeles!
deployment disable /path/to/DEPLOYMENT.war
deployment disable /path/to/DEPLOYMENT.war
You can use the deployment disable-all command to disable all the deployments.
deployment disable-all
deployment disable-all
11.14. Display the Active User Copiar enlaceEnlace copiado en el portapapeles!
Example: Command to Display the Current User
:whoami
:whoami
Example: Output for the Current User
11.15. Display the Contents of an Attachment Copiar enlaceEnlace copiado en el portapapeles!
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.
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)
attachment display --operation=/subsystem=logging/log-file=server.log:read-attribute(name=stream)
This outputs the contents of the server.log file to the console.
11.16. Display Schema Information Copiar enlaceEnlace copiado en el portapapeles!
To show the schema information for the :product-info command:
:read-operation-description(name=product-info)
: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 ...
...
management-major-version=4
management-micro-version=0
management-minor-version=1
...
11.17. Display System and Server Information Copiar enlaceEnlace copiado en el portapapeles!
Example: Command to Display the System and Server Information
:product-info
:product-info
Example: Output for the System and Server Information
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:product-info
/host=HOST_NAME/server=SERVER_NAME:product-info
/host=HOST_NAME/server=SERVER_NAME:product-info
11.18. Enable All Disabled Deployments Copiar enlaceEnlace copiado en el portapapeles!
deployment enable DEPLOYMENT.war
deployment enable DEPLOYMENT.war
You can use the deployment enable-all command to enable all the deployments.
deployment enable-all --server-groups=other-server-group
deployment enable-all --server-groups=other-server-group
11.19. Get the Command Timeout Value Copiar enlaceEnlace copiado en el portapapeles!
Example: Display the CLI Command Timeout Value
command-timeout get
command-timeout get
The value returned is in seconds. A value of 0 means no timeout.
11.20. Reload a Host Controller Copiar enlaceEnlace copiado en el portapapeles!
reload --host=HOST_NAME
reload --host=HOST_NAME
11.21. Reload a Host Controller in Admin-only Mode Copiar enlaceEnlace copiado en el portapapeles!
reload --host=HOST_NAME --admin-only=true
reload --host=HOST_NAME --admin-only=true
11.22. Reload All Servers in a Server Group Copiar enlaceEnlace copiado en el portapapeles!
Example: Reload All Servers in a Certain Server Group in a Managed Domain
/server-group=SERVER_GROUP_NAME:reload-servers
/server-group=SERVER_GROUP_NAME:reload-servers
To reload the servers in a suspended state, pass in the start-mode=suspend argument.
11.23. Reload a Server Copiar enlaceEnlace copiado en el portapapeles!
Example: Reload a Server in a Managed Domain
/host=HOST_NAME/server-config=SERVER_NAME:reload
/host=HOST_NAME/server-config=SERVER_NAME:reload
To reload the server in a suspended state, pass in the start-mode=suspend argument.
11.24. Reload a Standalone Server Copiar enlaceEnlace copiado en el portapapeles!
reload
reload
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 Copiar enlaceEnlace copiado en el portapapeles!
Example: Remove an Existing Extension
/extension=EXTENSION_NAME:remove
/extension=EXTENSION_NAME:remove
11.26. Remove a Module Copiar enlaceEnlace copiado en el portapapeles!
module remove --name=MODULE_NAME
module remove --name=MODULE_NAME
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 Copiar enlaceEnlace copiado en el portapapeles!
Example: Reset the Command Timeout to the Default Value
command-timeout reset default
command-timeout reset default
Example: Reset the Command Timeout to the Value Provided by the CLI Configuration
command-timeout reset config
command-timeout reset config
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 Copiar enlaceEnlace copiado en el portapapeles!
Example: Restart All Servers in a Certain Server Group in a Managed Domain
/server-group=SERVER_GROUP_NAME:restart-servers
/server-group=SERVER_GROUP_NAME:restart-servers
To restart the servers in a suspended state, pass in the start-mode=suspend argument.
11.29. Restart a Server Copiar enlaceEnlace copiado en el portapapeles!
Example: Restart a Server in a Managed Domain
/host=HOST_NAME/server-config=SERVER_NAME:restart
/host=HOST_NAME/server-config=SERVER_NAME:restart
To restart the server in a suspended state, pass in the start-mode=suspend argument.
11.30. Save the Contents of an Attachment Copiar enlaceEnlace copiado en el portapapeles!
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.
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
attachment save --operation=/subsystem=logging/log-file=server.log:read-attribute(name=stream) --file=log-output.txt
This saves the contents of the server.log file to EAP_HOME/bin/log-output.txt.
11.31. Set the Command Timeout Value Copiar enlaceEnlace copiado en el portapapeles!
Example: Set the Maximum Time to Wait for a CLI Command to Complete
command-timeout set TIMEOUT_VALUE
command-timeout set TIMEOUT_VALUE
The value is set in seconds. A value of 0 means no timeout.
11.32. Shut Down a Host Controller Copiar enlaceEnlace copiado en el portapapeles!
Example: Shut Down a Host Controller in a Managed Domain
shutdown --host=HOST_NAME
shutdown --host=HOST_NAME
11.33. Shut Down the Server Copiar enlaceEnlace copiado en el portapapeles!
Example: Shut Down a Standalone Server
shutdown
shutdown
11.34. Start All Servers in a Server Group Copiar enlaceEnlace copiado en el portapapeles!
Example: Start All Servers in a Certain Server Group in a Managed Domain
/server-group=SERVER_GROUP_NAME:start-servers
/server-group=SERVER_GROUP_NAME:start-servers
To start the servers in a suspended state, pass in the start-mode=suspend argument.
11.35. Start a Server Copiar enlaceEnlace copiado en el portapapeles!
Example: Start a Server in a Managed Domain
/host=HOST_NAME/server-config=SERVER_NAME:start
/host=HOST_NAME/server-config=SERVER_NAME:start
To start the server in a suspended state, pass in the start-mode=suspend argument.
11.36. Stop All Servers in a Server Group Copiar enlaceEnlace copiado en el portapapeles!
Example: Stop All Servers in a Certain Server Group in a Managed Domain
/server-group=SERVER_GROUP_NAME:stop-servers
/server-group=SERVER_GROUP_NAME:stop-servers
11.37. Stop a Server Copiar enlaceEnlace copiado en el portapapeles!
Example: Stop a Server in a Managed Domain
/host=HOST_NAME/server-config=SERVER_NAME:stop
/host=HOST_NAME/server-config=SERVER_NAME:stop
11.38. Take a Configuration Snapshot Copiar enlaceEnlace copiado en el portapapeles!
Example: Take a Snapshot of the Current Configurations
:take-snapshot
:take-snapshot
11.39. Undeploy All Applications Copiar enlaceEnlace copiado en el portapapeles!
Example: Undeploy All Applications from a Managed Domain
deployment undeploy * --all-relevant-server-groups
deployment undeploy * --all-relevant-server-groups
Example: Undeploy All Applications from a Standalone Domain
deployment undeploy *
deployment undeploy *
11.40. Undeploy an Application from a Managed Domain Copiar enlaceEnlace copiado en el portapapeles!
Example: Undeploy an Application from All Server Groups with That Deployment
deployment undeploy DEPLOYMENT.war --all-relevant-server-groups
deployment undeploy DEPLOYMENT.war --all-relevant-server-groups
Example: Undeploy an Application from a Specific Server Group
deployment undeploy DEPLOYMENT.war --server-groups=SERVER_GROUP_NAME
deployment undeploy DEPLOYMENT.war --server-groups=SERVER_GROUP_NAME
11.41. Undeploy an Application from a Standalone Server Copiar enlaceEnlace copiado en el portapapeles!
deployment undeploy DEPLOYMENT.war
deployment undeploy DEPLOYMENT.war
11.42. Update a Host Name Copiar enlaceEnlace copiado en el portapapeles!
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
/host=EXISTING_HOST_NAME:write-attribute(name=name,value=NEW_HOST_NAME)
reload --host=EXISTING_HOST_NAME
The host must be reloaded in order for the changes to take effect.
11.43. Upload an Attachment Copiar enlaceEnlace copiado en el portapapeles!
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}]
/deployment=DEPLOYMENT_NAME.war:add-content(content=[{target-path=/path/to/FILE_IN_DEPLOYMENT, input-stream-index=/path/to/LOCAL_FILE_TO_UPLOAD}]
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 Copiar enlaceEnlace copiado en el portapapeles!
/subsystem=logging/log-file=SERVER_LOG_NAME:read-log-file
/subsystem=logging/log-file=SERVER_LOG_NAME:read-log-file