== Management

=== CLI
You can use the +CLI+ to perform management operations on a standalone node or a domain controller.

----

bin/ispn-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.

=== 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
link:https://github.com/infinispan/infinispan-management-console[here].

NOTE: 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.

=== JMX

You can monitor an Infinispan Server over JMX in two ways:

* Use JConsole or VisualVM running locally as the same user. This will use a local link:http://www.oracle.com/technetwork/java/jvmstat-142257.html[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 you need to add the +$ISPN_HOME/bin/client/jboss-client.jar+ to your client's classpath and use one of the following service URLs:

* `service:jmx:remote-http-jmx://host:port` for plain connections through the management interface
* `service:jmx:remote-https-jmx://host:port` for TLS connections through the management interface (although this requires having the appropriate keys available)
* `service:jmx:remoting-jmx://localhost:port` for connections through the remoting interface (necessary for connecting to individual servers in a domain)

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.

[source,xml]
----

<subsystem xmlns="urn:jboss:domain:jmx:1.3">
    <expose-resolved-model/>
    <expose-expression-model/>
    <remoting-connector use-management-endpoint="false"/>
</subsystem>

----

=== Jolokia

You can also expose JMX beans using link:https://jolokia.org/[Jolokia]. In order to do this, just run the server with
additional parameter `--jmx`, for example: `./standalone.xml -c cloud.xml --jmx`. Jolokia configuration is stored in
`agent.conf` file. It is possible to override this file by specifying it after `--jmx` parameter. For example:
`./standalone.sh -c cloud.xml --jmx my-config.properties`.
