此内容没有您所选择的语言版本。
Chapter 5. Management
5.1. CLI
You can use the CLI to perform management operations on a standalone node or a domain controller.
$ bin/cli.sh [disconnected /] connect [standalone@localhost:9990 /] cd subsystem=datagrid-infinispan [standalone@localhost:9990 subsystem=datagrid-infinispan] cd cache-container=local [standalone@localhost:9990 cache-container=local] cd local-cache=default [standalone@localhost:9990 local-cache=default]
The CLI is extremely powerful and supports a number of useful features to navigate the management resource tree as well as inspecting single resources or entire subtrees. It is also possible to batch multiple commands together so that they are applied as a single operation.
5.2. Console
You can use the web console to perform management operations on servers running in either standalone or domain mode. The console only supports a subset of the operations provided by the CLI, however you can perform the following actions:
- View/Edit Cache Container Configuration
- Execute Tasks across Containers
- View/Edit Cache Configurations
- Create/Destroy Cache Instances
- View Cluster/Server/Cache Statistics
- View event logs
- Start/Stop servers/clusters (domain mode only)
To access the console start your server(s) in the required mode, navigate to http://localhost:9990
and enter your user credentials. If you would like to contribute to the development of the console, the source code can be found here.
Before you can use the web console, you must first setup at least one user account via the ./bin/add-user.sh
script. Detailed instructions of this process are presented in your browser if you attempt to access the console before creating any user accounts.
5.3. JMX
You can monitor an Red Hat Data Grid Server over JMX in two ways:
- Use JConsole or VisualVM running locally as the same user. This will use a local jvmstat connection and requires no additional setup
- Use JMX remoting (aka JSR-160) to connect from any host. This requires connecting through the management port (usually 9990) using a special protocol which respects the server security configuration
To setup a client for JMX remoting, add $RHDG_HOME/bin/client/jboss-cli-client.jar
to your client’s classpath and use one of the following service URLs:
-
service:jmx:remote+http://hostname:9990
for plain connections through the management interface -
service:jmx:remote+https://hostname:9993
for TLS connections through the management interface (although this requires having the appropriate keys available)
The JMX subsystem registers a service with the Remoting endpoint so that remote access to JMX can be obtained over the exposed Remoting connector. This is switched on by default in standalone mode and accessible over port 9990 but in domain mode it is switched off so it needs to be enabled. In domain mode the port will be the port of the Remoting connector for the Server instance to be monitored.
<subsystem xmlns="urn:jboss:domain:jmx:1.3"> <expose-resolved-model/> <expose-expression-model/> <remoting-connector use-management-endpoint="false"/> </subsystem>
5.4. Exposing JMX Beans to Prometheus
Start Red Hat Data Grid servers as follows:
$ ./standalone.sh -c cloud.xml --jmx 8180:my-config.yaml
5.5. Access Logs
Hot Rod and REST endpoints can record all inbound client requests as log entries with the following categories:
-
org.infinispan.HOTROD_ACCESS_LOG
logging category for the Hot Rod endpoint. -
org.infinispan.REST_ACCESS_LOG
logging category for the REST endpoint.
5.5.1. Enabling Access Logs
Access logs for Hot Rod and REST endpoints are disabled by default. To enable either logging category, set the level to TRACE
in the server configuration file, as in the following example:
<logger category="org.infinispan.HOTROD_ACCESS_LOG" use-parent-handlers="false"> <level name="TRACE"/> <handlers> <handler name="HR-ACCESS-FILE"/> </handlers> </logger>
5.5.2. Access Log Properties
The default format for access logs is as follows:
%X{address} %X{user} [%d{dd/MMM/yyyy:HH:mm:ss z}] "%X{method} %m %X{protocol}" %X{status} %X{requestSize} %X{responseSize} %X{duration}%n
The preceding format creates log entries such as the following:
127.0.0.1 - [30/Oct/2018:12:41:50 CET] "PUT /rest/default/key HTTP/1.1" 404 5 77 10
Logging properties use the %X{name}
notation and let you modify the format of access logs. The following are the default logging properties:
Property | Description |
---|---|
|
Either the |
| Principal name, if using authentication. |
|
Method used. |
|
Protocol used. |
|
An HTTP status code for the REST endpoint. |
| Size, in bytes, of the request. |
| Size, in bytes, of the response. |
| Number of milliseconds that the server took to handle the request. |
Use the header name prefixed with h:
to log headers that were included in requests; for example, %X{h:User-Agent}
.