Data Grid Server Guide
Deploy, secure, and manage Data Grid Server deployments
Abstract
Red Hat Data Grid Copy linkLink copied to clipboard!
Data Grid is a high-performance, distributed in-memory data store.
- Schemaless data structure
- Flexibility to store different objects as key-value pairs.
- Grid-based data storage
- Designed to distribute and replicate data across clusters.
- Elastic scaling
- Dynamically adjust the number of nodes to meet demand without service disruption.
- Data interoperability
- Store, retrieve, and query data in the grid from different endpoints.
Data Grid documentation Copy linkLink copied to clipboard!
Documentation for Data Grid is available on the Red Hat customer portal.
Data Grid downloads Copy linkLink copied to clipboard!
Access the Data Grid Software Downloads on the Red Hat customer portal.
You must have a Red Hat account to access and download Data Grid software.
Making open source more inclusive Copy linkLink copied to clipboard!
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Chapter 1. Getting started with Data Grid Server Copy linkLink copied to clipboard!
Quickly set up Data Grid Server and learn the basics.
Ansible collection
Automate installation of Data Grid clusters with our Ansible collection that optionally includes Keycloak caches and cross-site replication configuration. The Ansible collection also lets you inject Data Grid caches into the static configuration for each server instance during installation.
The Ansible collection for Data Grid is available from the Red Hat Automation Hub.
1.1. Data Grid Server requirements Copy linkLink copied to clipboard!
Data Grid Server requires a Java Virtual Machine. See the Data Grid Supported Configurations for details on supported versions.
1.2. Downloading Data Grid Server distributions Copy linkLink copied to clipboard!
The Data Grid Server distribution is an archive of Java libraries (JAR files) and configuration files.
Procedure
- Access the Red Hat customer portal.
- Download Red Hat Data Grid 8.3 Server from the software downloads section.
Run the
md5sumorsha256sumcommand with the server download archive as the argument, for example:sha256sum jboss-datagrid-${version}-server.zipsha256sum jboss-datagrid-${version}-server.zipCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Compare with the
MD5orSHA-256checksum value on the Data Grid Software Details page.
Reference
- Data Grid Server README describes the contents of the server distribution.
1.3. Installing Data Grid Server Copy linkLink copied to clipboard!
Install the Data Grid Server distribution on a host system.
Prerequisites
- Download a Data Grid Server distribution archive.
Procedure
- Use any appropriate tool to extract the Data Grid Server archive to the host filesystem.
unzip redhat-datagrid-8.3.1-server.zip
unzip redhat-datagrid-8.3.1-server.zip
The resulting directory is your $RHDG_HOME.
1.4. Starting Data Grid Server Copy linkLink copied to clipboard!
Run Data Grid Server instances in a Java Virtual Machine (JVM) on any supported host.
Prerequisites
- Download and install the server distribution.
Procedure
-
Open a terminal in
$RHDG_HOME. Start Data Grid Server instances with the
serverscript.- Linux
bin/server.sh
bin/server.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Microsoft Windows
bin\server.bat
bin\server.batCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Data Grid Server is running successfully when it logs the following messages:
ISPN080004: Protocol SINGLE_PORT listening on 127.0.0.1:11222 ISPN080034: Server '...' listening on http://127.0.0.1:11222 ISPN080001: Data Grid Server <version> started in <mm>ms
ISPN080004: Protocol SINGLE_PORT listening on 127.0.0.1:11222
ISPN080034: Server '...' listening on http://127.0.0.1:11222
ISPN080001: Data Grid Server <version> started in <mm>ms
Verification
-
Open
127.0.0.1:11222/console/in any browser. - Enter your credentials at the prompt and continue to Data Grid Console.
1.5. Passing Data Grid Server configuration at startup Copy linkLink copied to clipboard!
Specify custom configuration when you start Data Grid Server.
Data Grid Server can parse multiple configuration files that you overlay on startup with the --server-config argument. You can use as many configuration overlay files as required, in any order. Configuration overlay files:
-
Must be valid Data Grid configuration and contain the root
serverelement or field. - Do not need to be full configuration as long as your combination of overlay files results in a full configuration.
Data Grid Server does not detect conflicting configuration between overlay files. Each overlay file overwrites any conflicting configuration in the preceding configuration.
If you pass cache configuration to Data Grid Server on startup it does not dynamically create those cache across the cluster. You must manually propagate caches to each node.
Additionally, cache configuration that you pass to Data Grid Server on startup must include the infinispan and cache-container elements.
Prerequisites
- Download and install the server distribution.
-
Add custom server configuration to the
server/confdirectory of your Data Grid Server installation.
Procedure
-
Open a terminal in
$RHDG_HOME. Specify one or more configuration files with the
--server-config=or-cargument, for example:bin/server.sh -c infinispan.xml -c datasources.yaml -c security-realms.json
bin/server.sh -c infinispan.xml -c datasources.yaml -c security-realms.jsonCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.6. Creating and modifying Data Grid users Copy linkLink copied to clipboard!
Add Data Grid user credentials and assign permissions to control access to data.
Data Grid server installations use a property realm to authenticate users for the Hot Rod and REST endpoints. This means you need to create at least one user before you can access Data Grid.
By default, users also need roles with permissions to access caches and interact with Data Grid resources. You can assign roles to users individually or add users to groups that have role permissions.
You create users and assign roles with the user command in the Data Grid command line interface (CLI).
Run help user from a CLI session to get complete command details.
1.6.1. Adding credentials Copy linkLink copied to clipboard!
You need an admin user for the Data Grid Console and full control over your Data Grid environment. For this reason you should create a user with admin permissions the first time you add credentials.
Procedure
-
Open a terminal in
$RHDG_HOME. Create an
adminuser with theuser createcommand.Add a user assigned to the
admingroup.bin/cli.sh user create myuser -p changeme -g admin
bin/cli.sh user create myuser -p changeme -g adminCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use implicit authorization to gain
adminpermissions.bin/cli.sh user create admin -p changeme
bin/cli.sh user create admin -p changemeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Open
user.propertiesandgroups.propertieswith any text editor to verify users and groups.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.6.2. Assigning roles to users Copy linkLink copied to clipboard!
Assign roles to users so they have the correct permissions to access data and modify Data Grid resources.
Procedure
Start a CLI session with an
adminuser.bin/cli.sh
$ bin/cli.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow Assign the
deployerrole to "katie".[//containers/default]> user roles grant --roles=deployer katie
[//containers/default]> user roles grant --roles=deployer katieCopy to Clipboard Copied! Toggle word wrap Toggle overflow List roles for "katie".
[//containers/default]> user roles ls katie ["deployer"]
[//containers/default]> user roles ls katie ["deployer"]Copy to Clipboard Copied! Toggle word wrap Toggle overflow
1.6.3. Adding users to groups Copy linkLink copied to clipboard!
Groups let you change permissions for multiple users. You assign a role to a group and then add users to that group. Users inherit permissions from the group role.
Procedure
-
Start a CLI session with an
adminuser. Use the
user createcommand to create a group.-
Specify "developers" as the group name with the
--groupsargument. Set a username and password for the group.
In a property realm, a group is a special type of user that also requires a username and password.
[//containers/default]> user create --groups=developers developers -p changeme
[//containers/default]> user create --groups=developers developers -p changemeCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Specify "developers" as the group name with the
List groups.
[//containers/default]> user ls --groups ["developers"]
[//containers/default]> user ls --groups ["developers"]Copy to Clipboard Copied! Toggle word wrap Toggle overflow Assign the
applicationrole to the "developers" group.[//containers/default]> user roles grant --roles=application developers
[//containers/default]> user roles grant --roles=application developersCopy to Clipboard Copied! Toggle word wrap Toggle overflow List roles for the "developers" group.
[//containers/default]> user roles ls developers ["application"]
[//containers/default]> user roles ls developers ["application"]Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add existing users, one at a time, to the group as required.
[//containers/default]> user groups john --groups=developers
[//containers/default]> user groups john --groups=developersCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.6.4. User roles and permissions Copy linkLink copied to clipboard!
Data Grid includes a default set of roles that grant users with permissions to access data and interact with Data Grid resources.
ClusterRoleMapper is the default mechanism that Data Grid uses to associate security principals to authorization roles.
ClusterRoleMapper matches principal names to role names. A user named admin gets admin permissions automatically, a user named deployer gets deployer permissions, and so on.
| Role | Permissions | Description |
|---|---|---|
|
| ALL | Superuser with all permissions including control of the Cache Manager lifecycle. |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR, CREATE |
Can create and delete Data Grid resources in addition to |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR |
Has read and write access to Data Grid resources in addition to |
|
| ALL_READ, MONITOR |
Has read access to Data Grid resources in addition to |
|
| MONITOR |
Can view statistics via JMX and the |
1.7. Verifying cluster views Copy linkLink copied to clipboard!
Data Grid Server instances on the same network automatically discover each other and form clusters.
Complete this procedure to observe cluster discovery with the MPING protocol in the default TCP stack with locally running Data Grid Server instances. If you want to adjust cluster transport for custom network requirements, see the documentation for setting up Data Grid clusters.
This procedure is intended to demonstrate the principle of cluster discovery and is not intended for production environments. Doing things like specifying a port offset on the command line is not a reliable way to configure cluster transport for production.
Prerequisites
Have one instance of Data Grid Server running.
Procedure
-
Open a terminal in
$RHDG_HOME. Copy the root directory to
server2.cp -r server server2
cp -r server server2Copy to Clipboard Copied! Toggle word wrap Toggle overflow Specify a port offset and the
server2directory.bin/server.sh -o 100 -s server2
bin/server.sh -o 100 -s server2Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
You can view cluster membership in the console at 127.0.0.1:11222/console/cluster-membership.
Data Grid also logs the following messages when nodes join clusters:
1.8. Shutting down Data Grid Server Copy linkLink copied to clipboard!
Stop individually running servers or bring down clusters gracefully.
Procedure
- Create a CLI connection to Data Grid.
Shut down Data Grid Server in one of the following ways:
Stop all nodes in a cluster with the
shutdown clustercommand, for example:shutdown cluster
shutdown clusterCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command saves cluster state to the
datafolder for each node in the cluster. If you use a cache store, theshutdown clustercommand also persists all data in the cache.Stop individual server instances with the
shutdown servercommand and the server hostname, for example:shutdown server <my_server01>
shutdown server <my_server01>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The shutdown server command does not wait for rebalancing operations to complete, which can lead to data loss if you specify multiple hostnames at the same time.
Run help shutdown for more details about using the command.
Verification
Data Grid logs the following messages when you shut down servers:
ISPN080002: Data Grid Server stopping ISPN000080: Disconnecting JGroups channel cluster ISPN000390: Persisted state, version=<$version> timestamp=YYYY-MM-DDTHH:MM:SS ISPN080003: Data Grid Server stopped
ISPN080002: Data Grid Server stopping
ISPN000080: Disconnecting JGroups channel cluster
ISPN000390: Persisted state, version=<$version> timestamp=YYYY-MM-DDTHH:MM:SS
ISPN080003: Data Grid Server stopped
1.8.1. Data Grid cluster restarts Copy linkLink copied to clipboard!
When you bring Data Grid clusters back online after shutting them down, you should wait for the cluster to be available before adding or removing nodes or modifying cluster state.
If you shutdown clustered nodes with the shutdown server command, you must restart each server in reverse order.
For example, if you shutdown server1 and then shutdown server2, you should first start server2 and then start server1.
If you shutdown a cluster with the shutdown cluster command, clusters become fully operational only after all nodes rejoin.
You can restart nodes in any order but the cluster remains in DEGRADED state until all nodes that were joined before shutdown are running.
1.9. Data Grid Server installation directory structure Copy linkLink copied to clipboard!
Data Grid Server uses the following folders on the host filesystem under $RHDG_HOME:
See the Data Grid Server README for descriptions of the each folder in your $RHDG_HOME directory as well as system properties you can use to customize the filesystem.
1.9.1. Server root directory Copy linkLink copied to clipboard!
Apart from resources in the bin and docs folders, the only folder under $RHDG_HOME that you should interact with is the server root directory, which is named server by default.
You can create multiple nodes under the same $RHDG_HOME directory or in different directories, but each Data Grid Server instance must have its own server root directory. For example, a cluster of 5 nodes could have the following server root directories on the filesystem:
├── server ├── server1 ├── server2 ├── server3 └── server4
├── server
├── server1
├── server2
├── server3
└── server4
Each server root directory should contain the following folders:
├── server │ ├── conf │ ├── data │ ├── lib │ └── log
├── server
│ ├── conf
│ ├── data
│ ├── lib
│ └── log
server/conf
Holds infinispan.xml configuration files for a Data Grid Server instance.
Data Grid separates configuration into two layers:
- Dynamic
-
Create mutable cache configurations for data scalability.
Data Grid Server permanently saves the caches you create at runtime along with the cluster state that is distributed across nodes. Each joining node receives a complete cluster state that Data Grid Server synchronizes across all nodes whenever changes occur. - Static
-
Add configuration to
infinispan.xmlfor underlying server mechanisms such as cluster transport, security, and shared datasources.
server/data
Provides internal storage that Data Grid Server uses to maintain cluster state.
Never directly delete or modify content in server/data.
Modifying files such as caches.xml while the server is running can cause corruption. Deleting content can result in an incorrect state, which means clusters cannot restart after shutdown.
server/lib
Contains extension JAR files for custom filters, custom event listeners, JDBC drivers, custom ServerTask implementations, and so on.
server/log
Holds Data Grid Server log files.
Chapter 2. Network interfaces and socket bindings Copy linkLink copied to clipboard!
Expose Data Grid Server through a network interface by binding it to an IP address. You can then configure endpoints to use the interface so Data Grid Server can handle requests from remote client applications.
2.1. Network interfaces Copy linkLink copied to clipboard!
Data Grid Server multiplexes endpoints to a single TCP/IP port and automatically detects protocols of inbound client requests. You can configure how Data Grid Server binds to network interfaces to listen for client requests.
Internet Protocol (IP) address
XML
JSON
YAML
server:
interfaces:
- name: "public"
inetAddress:
value: "127.0.0.1"
server:
interfaces:
- name: "public"
inetAddress:
value: "127.0.0.1"
Loopback address
XML
JSON
YAML
server:
interfaces:
- name: "public"
loopback: ~
server:
interfaces:
- name: "public"
loopback: ~
Non-loopback address
XML
JSON
YAML
server:
interfaces:
- name: "public"
nonLoopback: ~
server:
interfaces:
- name: "public"
nonLoopback: ~
Any address
XML
JSON
YAML
server:
interfaces:
- name: "public"
anyAddress: ~
server:
interfaces:
- name: "public"
anyAddress: ~
Link local
XML
JSON
YAML
server:
interfaces:
- name: "public"
linkLocal: ~
server:
interfaces:
- name: "public"
linkLocal: ~
Site local
XML
JSON
YAML
server:
interfaces:
- name: "public"
siteLocal: ~
server:
interfaces:
- name: "public"
siteLocal: ~
2.1.1. Match and fallback strategies Copy linkLink copied to clipboard!
Data Grid Server can enumerate all network interfaces on the host system and bind to an interface, host, or IP address that matches a value, which can include regular expressions for additional flexibility.
Match host
XML
JSON
YAML
server:
interfaces:
- name: "public"
matchHost:
value: "my_host_name"
server:
interfaces:
- name: "public"
matchHost:
value: "my_host_name"
Match interface
XML
JSON
YAML
server:
interfaces:
- name: "public"
matchInterface:
value: "eth0"
server:
interfaces:
- name: "public"
matchInterface:
value: "eth0"
Match address
XML
JSON
YAML
server:
interfaces:
- name: "public"
matchAddress:
value: "127\\..*"
server:
interfaces:
- name: "public"
matchAddress:
value: "127\\..*"
Fallback
XML
JSON
YAML
2.2. Socket bindings Copy linkLink copied to clipboard!
Socket bindings map endpoint connectors to network interfaces and ports. By default, Data Grid Server includes a socket binding configuration that listens on the localhost interface, 127.0.0.1, at port 11222 for the REST and Hot Rod endpoints. If you enable the Memcached endpoint, the default socket bindings configure Data Grid Server to bind to port 11221.
Default socket bindings
| Configuration element or attribute | Description |
|---|---|
|
| Root element that contains all network interfaces and ports to which Data Grid Server endpoints can bind and listen for client connections. |
|
| Declare the network interface that Data Grid Server listens on by default. |
|
| Specifies the offset that Data Grid Server applies to port declarations for socket bindings. |
|
| Configures Data Grid Server to bind to a port on a network interface. |
Custom socket binding declarations
The following example configuration adds an interface declaration named "private" and a socket-binding declaration that binds Data Grid Server to the private IP address:
XML
JSON
YAML
2.3. Changing the bind address for Data Grid Server Copy linkLink copied to clipboard!
Data Grid Server binds to a network IP address to listen for inbound client connections on the Hot Rod and REST endpoints. You can specify that IP address directly in your Data Grid Server configuration or when starting server instances.
Prerequisites
- Have at least one Data Grid Server installation.
Procedure
Specify the IP address to which Data Grid Server binds in one of the following ways:
Open your Data Grid Server configuration and set the value for the
inet-addresselement, for example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
-boption or theinfinispan.bind.addresssystem property.Linux
bin/server.sh -b 192.0.2.0
bin/server.sh -b 192.0.2.0Copy to Clipboard Copied! Toggle word wrap Toggle overflow Windows
bin\server.bat -b 192.0.2.0
bin\server.bat -b 192.0.2.0Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.3.1. Listening on all addresses Copy linkLink copied to clipboard!
If you specify the 0.0.0.0 meta-address, or INADDR_ANY, as the bind address in your Data Grid Server configuration, it listens for incoming client connections on all available network interfaces.
Client intelligence
Configuring Data Grid to listen on all addresses affects how it provides Hot Rod clients with cluster topology. If there are multiple interfaces to which Data Grid Server binds, then it sends a list of IP addresses for each interface.
For example, a cluster where each server node binds to:
-
10.0.0.0/8subnet -
192.168.0.0/16subnet -
127.0.0.1loopback
Hot Rod clients receive IP addresses for server nodes that belong to the interface through which the clients connect. If a client connects to 192.168.0.0, for example, it does not receive any cluster topology details for nodes that listen on 10.0.0.0.
Netmask override
Kubernetes, and some other environments, divide the IP address space into subnets and use those different subnets as a single network. For example, 10.129.2.100/23 and 10.129.4.100/23 are in different subnets but belong to the 10.0.0.0/8 network.
For this reason, Data Grid Server overrides netmasks that the host system provides with netmasks that follow IANA conventions for private and reserved networks:
-
IPv4:
10.0.0.0/8,192.168.0.0/16,172.16.0.0/12,169.254.0.0/16and240.0.0.0/4 -
IPv6:
fc00::/7andfe80::/10
See RFC 1918 for IPv4 or RFC 4193 and RFC 3513 for IPv6.
You can optionally configure the Hot Rod connector to use the netmask that the host system provides for interfaces with the network-prefix-override attribute in your Data Grid Server configuration.
2.4. Data Grid Server ports and protocols Copy linkLink copied to clipboard!
Data Grid Server provides network endpoints that allow client access with different protocols.
| Port | Protocol | Description |
|---|---|---|
|
| TCP | Hot Rod and REST |
|
| TCP | Memcached (disabled by default) |
Single port
Data Grid Server exposes multiple protocols through a single TCP port, 11222. Handling multiple protocols with a single port simplifies configuration and reduces management complexity when deploying Data Grid clusters. Using a single port also enhances security by minimizing the attack surface on the network.
Data Grid Server handles HTTP/1.1, HTTP/2, and Hot Rod protocol requests from clients via the single port in different ways.
HTTP/1.1 upgrade headers
Client requests can include the HTTP/1.1 upgrade header field to initiate HTTP/1.1 connections with Data Grid Server. Client applications can then send the Upgrade: protocol header field, where protocol is a server endpoint.
Application-Layer Protocol Negotiation (ALPN)/Transport Layer Security (TLS)
Client requests include Server Name Indication (SNI) mappings for Data Grid Server endpoints to negotiate protocols over a TLS connection.
Applications must use a TLS library that supports the ALPN extension. Data Grid uses WildFly OpenSSL bindings for Java.
Automatic Hot Rod detection
Client requests that include Hot Rod headers automatically route to Hot Rod endpoints.
2.4.1. Configuring network firewalls for Data Grid traffic Copy linkLink copied to clipboard!
Adjust firewall rules to allow traffic between Data Grid Server and client applications.
Procedure
On Red Hat Enterprise Linux (RHEL) workstations, for example, you can allow traffic to port 11222 with firewalld as follows:
firewall-cmd --add-port=11222/tcp --permanent success firewall-cmd --list-ports | grep 11222 11222/tcp
# firewall-cmd --add-port=11222/tcp --permanent
success
# firewall-cmd --list-ports | grep 11222
11222/tcp
To configure firewall rules that apply across a network, you can use the nftables utility.
2.5. Specifying port offsets Copy linkLink copied to clipboard!
Configure port offsets for multiple Data Grid Server instances on the same host. The default port offset is 0.
Procedure
Use the -o switch with the Data Grid CLI or the infinispan.socket.binding.port-offset system property to set port offsets.
For example, start a server instance with an offset of 100 as follows. With the default configuration, this results in the Data Grid server listening on port 11322.
- Linux
bin/server.sh -o 100
bin/server.sh -o 100
- Windows
bin\server.bat -o 100
bin\server.bat -o 100
Chapter 3. Data Grid Server endpoints Copy linkLink copied to clipboard!
Data Grid Server endpoints provide client access to the cache manager over Hot Rod and REST protocols.
3.1. Data Grid Server endpoints Copy linkLink copied to clipboard!
3.1.1. Hot Rod Copy linkLink copied to clipboard!
Hot Rod is a binary TCP client-server protocol designed to provide faster data access and improved performance in comparison to text-based protocols.
Data Grid provides Hot Rod client libraries in Java, C++, C#, Node.js and other programming languages.
Topology state transfer
Data Grid uses topology caches to provide clients with cluster views. Topology caches contain entries that map internal JGroups transport addresses to exposed Hot Rod endpoints.
When client send requests, Data Grid servers compare the topology ID in request headers with the topology ID from the cache. Data Grid servers send new topology views if client have older topology IDs.
Cluster topology views allow Hot Rod clients to immediately detect when nodes join and leave, which enables dynamic load balancing and failover.
In distributed cache modes, the consistent hashing algorithm also makes it possible to route Hot Rod client requests directly to primary owners.
3.1.2. REST Copy linkLink copied to clipboard!
Data Grid exposes a RESTful interface that allows HTTP clients to access data, monitor and maintain clusters, and perform administrative operations.
You can use standard HTTP load balancers to provide clients with load balancing and failover capabilities. However, HTTP load balancers maintain static cluster views and require manual updates when cluster topology changes occur.
3.1.3. Memcached Copy linkLink copied to clipboard!
Data Grid provides an implementation of the Memcached text protocol for remote client access.
The Memcached endpoint is deprecated and planned for removal in a future release.
The Data Grid Memcached endpoint supports clustering with replicated and distributed cache modes.
There are some Memcached client implementations, such as the Cache::Memcached Perl client, that can offer load balancing and failover detection capabilities with static lists of Data Grid server addresses that require manual updates when cluster topology changes occur.
3.1.4. Comparison of endpoint protocols Copy linkLink copied to clipboard!
| Hot Rod | HTTP / REST | |
|---|---|---|
| Topology-aware | Y | N |
| Hash-aware | Y | N |
| Encryption | Y | Y |
| Authentication | Y | Y |
| Conditional ops | Y | Y |
| Bulk ops | Y | N |
| Transactions | Y | N |
| Listeners | Y | N |
| Query | Y | Y |
| Execution | Y | N |
| Cross-site failover | Y | N |
3.1.5. Hot Rod client compatibility with Data Grid Server Copy linkLink copied to clipboard!
Data Grid Server allows you to connect Hot Rod clients with different versions. For instance during a migration or upgrade to your Data Grid cluster, the Hot Rod client version might be a lower Data Grid version than Data Grid Server.
Data Grid recommends using the latest Hot Rod client version to benefit from the most recent capabilities and security enhancements.
Data Grid 8 and later
Hot Rod protocol version 3.x automatically negotiates the highest version possible for clients with Data Grid Server.
Data Grid 7.3 and earlier
Clients that use a Hot Rod protocol version that is higher than the Data Grid Server version must set the infinispan.client.hotrod.protocol_version property.
3.2. Configuring Data Grid Server endpoints Copy linkLink copied to clipboard!
Control how Hot Rod and REST endpoints bind to sockets and use security realm configuration. You can also configure multiple endpoints and disable administrative capabilities.
Each unique endpoint configuration must include both a Hot Rod connector and a REST connector. Data Grid Server implicitly includes the hotrod-connector and rest-connector elements, or fields, in an endpoint configuration. You should only add these elements to custom configuration to specify authentication mechanisms for endpoints.
Prerequisites
- Add socket bindings and security realms to your Data Grid Server configuration.
Procedure
- Open your Data Grid Server configuration for editing.
-
Wrap multiple
endpointconfigurations with theendpointselement. -
Specify the socket binding that the endpoint uses with the
socket-bindingattribute. -
Specify the security realm that the endpoint uses with the
security-realmattribute. Disable administrator access with the
admin="false"attribute, if required.With this configuration users cannot access Data Grid Console or the Command Line Interface (CLI) from the endpoint.
- Save the changes to your configuration.
Multiple endpoint configuration
The following Data Grid Server configuration creates endpoints on separate socket bindings with dedicated security realms:
XML
JSON
YAML
3.3. Endpoint connectors Copy linkLink copied to clipboard!
Connectors configure Hot Rod and REST endpoints to use socket bindings and security realms.
Default endpoint configuration
<endpoints socket-binding="default" security-realm="default"/>
<endpoints socket-binding="default" security-realm="default"/>
| Configuration element or attribute | Description |
|---|---|
|
| Wraps endpoint connector configuration. |
|
| Declares a Data Grid Server endpoint that configures Hot Rod and REST connectors to use a socket binding and security realm. |
|
|
Includes the Hot Rod endpoint in the |
|
|
Includes the Hot Rod endpoint in the |
|
| Configures the Memcached endpoint and is disabled by default. |
3.4. Endpoint IP address filtering rules Copy linkLink copied to clipboard!
Data Grid Server endpoints can use filtering rules that control whether clients can connect based on their IP addresses. Data Grid Server applies filtering rules in order until it finds a match for the client IP address.
A CIDR block is a compact representation of an IP address and its associated network mask. CIDR notation specifies an IP address, a slash ('/') character, and a decimal number. The decimal number is the count of leading 1 bits in the network mask. The number can also be thought of as the width, in bits, of the network prefix. The IP address in CIDR notation is always represented according to the standards for IPv4 or IPv6.
The address can denote a specific interface address, including a host identifier, such as 10.0.0.1/8, or it can be the beginning address of an entire network interface range using a host identifier of 0, as in 10.0.0.0/8 or 10/8.
For example:
-
192.168.100.14/24represents the IPv4 address192.168.100.14and its associated network prefix192.168.100.0, or equivalently, its subnet mask255.255.255.0, which has 24 leading 1-bits. -
the IPv4 block
192.168.100.0/22represents the 1024 IPv4 addresses from192.168.100.0to192.168.103.255. -
the IPv6 block
2001:db8::/48represents the block of IPv6 addresses from2001:db8:0:0:0:0:0:0to2001:db8:0:ffff:ffff:ffff:ffff:ffff. -
::1/128represents the IPv6 loopback address. Its prefix length is 128 which is the number of bits in the address.
IP address filter configuration
In the following configuration, Data Grid Server accepts connections only from addresses in the 192.168.0.0/16 and 10.0.0.0/8 CIDR blocks. Data Grid Server rejects all other connections.
XML
JSON
YAML
3.5. Inspecting and modifying rules for filtering IP addresses Copy linkLink copied to clipboard!
Configure IP address filtering rules on Data Grid Server endpoints to accept or reject connections based on client address.
Prerequisites
- Install Data Grid Command Line Interface (CLI).
Procedure
- Create a CLI connection to Data Grid Server.
Inspect and modify the IP filter rules
server connector ipfiltercommand as required.List all IP filtering rules active on a connector across the cluster:
server connector ipfilter ls endpoint-default
server connector ipfilter ls endpoint-defaultCopy to Clipboard Copied! Toggle word wrap Toggle overflow Set IP filtering rules across the cluster.
NoteThis command replaces any existing rules.
server connector ipfilter set endpoint-default --rules=ACCEPT/192.168.0.0/16,REJECT/10.0.0.0/8`
server connector ipfilter set endpoint-default --rules=ACCEPT/192.168.0.0/16,REJECT/10.0.0.0/8`Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove all IP filtering rules on a connector across the cluster.
server connector ipfilter clear endpoint-default
server connector ipfilter clear endpoint-defaultCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 4. Endpoint authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server can use custom SASL and HTTP authentication mechanisms for Hot Rod and REST endpoints.
4.1. Data Grid Server authentication Copy linkLink copied to clipboard!
Authentication restricts user access to endpoints as well as the Data Grid Console and Command Line Interface (CLI).
Data Grid Server includes a "default" security realm that enforces user authentication. Default authentication uses a property realm with user credentials stored in the server/conf/users.properties file. Data Grid Server also enables security authorization by default so you must assign users with permissions stored in the server/conf/groups.properties file.
Use the user create command with the Command Line Interface (CLI) to add users and assign permissions. Run user create --help for examples and more information.
4.2. Configuring Data Grid Server authentication mechanisms Copy linkLink copied to clipboard!
You can explicitly configure Hot Rod and REST endpoints to use specific authentication mechanisms. Configuring authentication mechanisms is required only if you need to explicitly override the default mechanisms for a security realm.
Each endpoint section in your configuration must include hotrod-connector and rest-connector elements or fields. For example, if you explicitly declare a hotrod-connector you must also declare a rest-connector even if it does not configure an authentication mechanism.
Prerequisites
- Add security realms to your Data Grid Server configuration as required.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add an
endpointelement or field and specify the security realm that it uses with thesecurity-realmattribute. Add a
hotrod-connectorelement or field to configure the Hot Rod endpoint.-
Add an
authenticationelement or field. -
Specify SASL authentication mechanisms for the Hot Rod endpoint to use with the
sasl mechanismsattribute. -
If applicable, specify SASL quality of protection settings with the
qopattribute. -
Specify the Data Grid Server identity with the
server-nameattribute if necessary.
-
Add an
Add a
rest-connectorelement or field to configure the REST endpoint.-
Add an
authenticationelement or field. -
Specify HTTP authentication mechanisms for the REST endpoint to use with the
mechanismsattribute.
-
Add an
- Save the changes to your configuration.
Authentication mechanism configuration
The following configuration specifies SASL mechanisms for the Hot Rod endpoint to use for authentication:
XML
JSON
YAML
4.2.1. Disabling authentication Copy linkLink copied to clipboard!
In local development environments or on isolated networks you can configure Data Grid to allow unauthenticated client requests. When you disable user authentication you should also disable authorization in your Data Grid security configuration.
Procedure
- Open your Data Grid Server configuration for editing.
-
Remove the
security-realmattribute from theendpointselement or field. -
Remove any
authorizationelements from thesecurityconfiguration for thecache-containerand each cache configuration. - Save the changes to your configuration.
XML
<server xmlns="urn:infinispan:server:13.0"> <endpoints socket-binding="default"/> </server>
<server xmlns="urn:infinispan:server:13.0">
<endpoints socket-binding="default"/>
</server>
JSON
YAML
server:
endpoints:
endpoint:
socketBinding: "default"
server:
endpoints:
endpoint:
socketBinding: "default"
4.3. Data Grid Server authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server automatically configures endpoints with authentication mechanisms that match your security realm configuration. For example, if you add a Kerberos security realm then Data Grid Server enables the GSSAPI and GS2-KRB5 authentication mechanisms for the Hot Rod endpoint.
Hot Rod endpoints
Data Grid Server enables the following SASL authentication mechanisms for Hot Rod endpoints when your configuration includes the corresponding security realm:
| Security realm | SASL authentication mechanism |
|---|---|
| Property realms and LDAP realms |
SCRAM-*, DIGEST-*, |
| Token realms | OAUTHBEARER |
| Trust realms | EXTERNAL |
| Kerberos identities | GSSAPI, GS2-KRB5 |
| SSL/TLS identities | PLAIN |
REST endpoints
Data Grid Server enables the following HTTP authentication mechanisms for REST endpoints when your configuration includes the corresponding security realm:
| Security realm | HTTP authentication mechanism |
|---|---|
| Property realms and LDAP realms | DIGEST |
| Token realms | BEARER_TOKEN |
| Trust realms | CLIENT_CERT |
| Kerberos identities | SPNEGO |
| SSL/TLS identities | BASIC |
4.3.1. SASL authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server supports the following SASL authentications mechanisms with Hot Rod endpoints:
| Authentication mechanism | Description | Security realm type | Related details |
|---|---|---|---|
|
|
Uses credentials in plain-text format. You should use | Property realms and LDAP realms |
Similar to the |
|
|
Uses hashing algorithms and nonce values. Hot Rod connectors support | Property realms and LDAP realms |
Similar to the |
|
|
Uses salt values in addition to hashing algorithms and nonce values. Hot Rod connectors support | Property realms and LDAP realms |
Similar to the |
|
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding | Kerberos realms |
Similar to the |
|
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding | Kerberos realms |
Similar to the |
|
| Uses client certificates. | Trust store realms |
Similar to the |
|
|
Uses OAuth tokens and requires a | Token realms |
Similar to the |
4.3.2. SASL quality of protection (QoP) Copy linkLink copied to clipboard!
If SASL mechanisms support integrity and privacy protection (QoP) settings, you can add them to your Hot Rod endpoint configuration with the qop attribute.
| QoP setting | Description |
|---|---|
|
| Authentication only. |
|
| Authentication with integrity protection. |
|
| Authentication with integrity and privacy protection. |
4.3.3. SASL policies Copy linkLink copied to clipboard!
SASL policies provide fine-grain control over Hot Rod authentication mechanisms.
Data Grid cache authorization restricts access to caches based on roles and permissions. Configure cache authorization and then set <no-anonymous value=false /> to allow anonymous login and delegate access logic to cache authorization.
| Policy | Description | Default value |
|---|---|---|
|
| Use only SASL mechanisms that support forward secrecy between sessions. This means that breaking into one session does not automatically provide information for breaking into future sessions. | false |
|
| Use only SASL mechanisms that require client credentials. | false |
|
| Do not use SASL mechanisms that are susceptible to simple plain passive attacks. | false |
|
| Do not use SASL mechanisms that are susceptible to active, non-dictionary, attacks. | false |
|
| Do not use SASL mechanisms that are susceptible to passive dictionary attacks. | false |
|
| Do not use SASL mechanisms that accept anonymous logins. | true |
SASL policy configuration
In the following configuration the Hot Rod endpoint uses the GSSAPI mechanism for authentication because it is the only mechanism that complies with all SASL policies:
XML
JSON
YAML
4.3.4. HTTP authentication mechanisms Copy linkLink copied to clipboard!
Data Grid Server supports the following HTTP authentication mechanisms with REST endpoints:
| Authentication mechanism | Description | Security realm type | Related details |
|---|---|---|---|
|
|
Uses credentials in plain-text format. You should use | Property realms and LDAP realms |
Corresponds to the |
|
|
Uses hashing algorithms and nonce values. REST connectors support | Property realms and LDAP realms |
Corresponds to the |
|
|
Uses Kerberos tickets and requires a Kerberos Domain Controller. You must add a corresponding | Kerberos realms |
Corresponds to the |
|
|
Uses OAuth tokens and requires a | Token realms |
Corresponds to the |
|
| Uses client certificates. | Trust store realms |
Similar to the |
Chapter 5. Security realms Copy linkLink copied to clipboard!
Security realms integrate Data Grid Server deployments with the network protocols and infrastructure in your environment that control access and verify user identities.
5.1. Creating security realms Copy linkLink copied to clipboard!
Add security realms to Data Grid Server configuration to control access to deployments. You can add one or more security realm to your configuration.
When you add security realms to your configuration, Data Grid Server automatically enables the matching authentication mechanisms for the Hot Rod and REST endpoints.
Prerequisites
- Add socket bindings to your Data Grid Server configuration as required.
Create keystores, or have a PEM file, to configure the security realm with TLS/SSL encryption.
Data Grid Server can also generate keystores at startup.
-
Provision the resources or services that the security realm configuration relies on.
For example, if you add a token realm, you need to provision OAuth services.
This procedure demonstrates how to configure multiple property realms. Before you begin, you need to create properties files that add users and assign permissions with the Command Line Interface (CLI). Use the user create commands as follows:
Run user create --help for examples and more information.
Adding credentials to a properties realm with the CLI creates the user only on the server instance to which you are connected. You must manually synchronize credentials in a properties realm to each node in the cluster.
Procedure
- Open your Data Grid Server configuration for editing.
-
Use the
security-realmselement in thesecurityconfiguration to contain create multiple security realms. Add a security realm with the
security-realmelement and give it a unique name with thenameattribute.ImportantDo not add special characters, such as hyphens (
-) or ampersands (&), to security realm names. Data Grid Server endpoints can become unreachable if security realm names contain special characters.To follow the example, create one security realm named
ApplicationRealmand another namedManagementRealm.-
Provide the TLS/SSL identify for Data Grid Server with the
server-identitieselement and configure a keystore as required. Specify the type of security realm by adding one the following elements or fields:
-
properties-realm -
ldap-realm -
token-realm -
truststore-realm
-
Specify properties for the type of security realm you are configuring as appropriate.
To follow the example, specify the
*.propertiesfiles you created with the CLI using thepathattribute on theuser-propertiesandgroup-propertieselements or fields.-
If you add multiple different types of security realm to your configuration, include the
distributed-realmelement or field so that Data Grid Server uses the realms in combination with each other. -
Configure Data Grid Server endpoints to use the security realm with the with the
security-realmattribute. - Save the changes to your configuration.
Multiple property realms
The following configuration shows how you can configure multiple security realms in XML, JSON, or YAML format:
XML
JSON
YAML
5.2. Setting up Kerberos identities Copy linkLink copied to clipboard!
Add Kerberos identities to a security realm in your Data Grid Server configuration to use keytab files that contain service principal names and encrypted keys, derived from Kerberos passwords.
Prerequisites
- Have Kerberos service account principals.
keytab files can contain both user and service account principals. However, Data Grid Server uses service account principals only which means it can provide identity to clients and allow clients to authenticate with Kerberos servers.
In most cases, you create unique principals for the Hot Rod and REST endpoints. For example, if you have a "datagrid" server in the "INFINISPAN.ORG" domain you should create the following service principals:
-
hotrod/datagrid@INFINISPAN.ORGidentifies the Hot Rod service. -
HTTP/datagrid@INFINISPAN.ORGidentifies the REST service.
Procedure
Create keytab files for the Hot Rod and REST services.
- Linux
ktutil ktutil: addent -password -p datagrid@INFINISPAN.ORG -k 1 -e aes256-cts Password for datagrid@INFINISPAN.ORG: [enter your password] ktutil: wkt http.keytab ktutil: quit
ktutil ktutil: addent -password -p datagrid@INFINISPAN.ORG -k 1 -e aes256-cts Password for datagrid@INFINISPAN.ORG: [enter your password] ktutil: wkt http.keytab ktutil: quitCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Microsoft Windows
ktpass -princ HTTP/datagrid@INFINISPAN.ORG -pass * -mapuser INFINISPAN\USER_NAME ktab -k http.keytab -a HTTP/datagrid@INFINISPAN.ORG
ktpass -princ HTTP/datagrid@INFINISPAN.ORG -pass * -mapuser INFINISPAN\USER_NAME ktab -k http.keytab -a HTTP/datagrid@INFINISPAN.ORGCopy to Clipboard Copied! Toggle word wrap Toggle overflow
-
Copy the keytab files to the
server/confdirectory of your Data Grid Server installation. - Open your Data Grid Server configuration for editing.
-
Add a
server-identitiesdefinition to the Data Grid server security realm. - Specify the location of keytab files that provide service principals to Hot Rod and REST connectors.
- Name the Kerberos service principals.
- Save the changes to your configuration.
Kerberos identity configuration
XML
JSON
YAML
5.3. Property realms Copy linkLink copied to clipboard!
Property realms use property files to define users and groups.
-
users.propertiescontains Data Grid user credentials. Passwords can be pre-digested with theDIGEST-MD5andDIGESTauthentication mechanisms. -
groups.propertiesassociates users with roles and permissions.
Properties files contain headers that associate them with security realms in Data Grid Server configuration.
users.properties
myuser=a_password user2=another_password
myuser=a_password
user2=another_password
groups.properties
myuser=supervisor,reader,writer user2=supervisor
myuser=supervisor,reader,writer
user2=supervisor
Property realm configuration
XML
JSON
YAML
5.4. LDAP realms Copy linkLink copied to clipboard!
LDAP realms connect to LDAP servers, such as OpenLDAP, Red Hat Directory Server, Apache Directory Server, or Microsoft Active Directory, to authenticate users and obtain membership information.
LDAP servers can have different entry layouts, depending on the type of server and deployment. It is beyond the scope of this document to provide examples for all possible configurations.
The principal for LDAP connections must have necessary privileges to perform LDAP queries and access specific attributes.
As an alternative to verifying user credentials with the direct-verification attribute, you can specify an LDAP attribute that validates passwords with the user-password-mapper element.
You cannot use endpoint authentication mechanisms that perform hashing with the direct-verification attribute.
Because Active Directory does not expose the password attribute you can use the direct-verification attribute only and not the user-password-mapper element. As a result you must use the BASIC authentication mechanism with the REST endpoint and PLAIN with the Hot Rod endpoint to integrate with Active Directory Server. A more secure alternative is to use Kerberos, which allows the SPNEGO, GSSAPI, and GS2-KRB5 authentication mechanisms.
The rdn-identifier attribute specifies an LDAP attribute that finds the user entry based on a provided identifier, which is typically a username; for example, the uid or sAMAccountName attribute. Add search-recursive="true" to the configuration to search the directory recursively. By default, the search for the user entry uses the (rdn_identifier={0}) filter. Specify a different filter with the filter-name attribute.
The attribute-mapping element retrieves all the groups of which the user is a member. There are typically two ways in which membership information is stored:
-
Under group entries that usually have class
groupOfNamesin thememberattribute. In this case, you can use an attribute filter as in the preceding example configuration. This filter searches for entries that match the supplied filter, which locates groups with amemberattribute equal to the user’s DN. The filter then extracts the group entry’s CN as specified byfrom, and adds it to the user’sRoles. In the user entry in the
memberOfattribute. In this case you should use an attribute reference such as the following:<attribute-reference reference="memberOf" from="cn" to="Roles" />This reference gets all
memberOfattributes from the user’s entry, extracts the CN as specified byfrom, and adds them to the user’sRoles.
LDAP realm configuration
XML
JSON
YAML
5.4.1. LDAP realm principal re-writing Copy linkLink copied to clipboard!
SASL authentication mechanisms such as GSSAPI, GS2-KRB5 and Negotiate include a username that needs to be cleaned up before you can use it to search LDAP directories.
XML
JSON
YAML
5.5. Token realms Copy linkLink copied to clipboard!
Token realms use external services to validate tokens and require providers that are compatible with RFC-7662 (OAuth2 Token Introspection), such as Red Hat SSO.
Token realm configuration
XML
JSON
YAML
5.6. Trust store realms Copy linkLink copied to clipboard!
Trust store realms use certificates, or certificates chains, that verify Data Grid Server and client identities when they negotiate connections.
- Keystores
- Contain server certificates that provide a Data Grid Server identity to clients. If you configure a keystore with server certificates, Data Grid Server encrypts traffic using industry standard SSL/TLS protocols.
- Trust stores
- Contain client certificates, or certificate chains, that clients present to Data Grid Server. Client trust stores are optional and allow Data Grid Server to perform client certificate authentication.
Client certificate authentication
You must add the require-ssl-client-auth="true" attribute to the endpoint configuration if you want Data Grid Server to validate or authenticate client certificates.
Trust store realm configuration
XML
JSON
YAML
5.7. Distributed security realms Copy linkLink copied to clipboard!
Distributed realms combine multiple different types of security realms. When users attempt to access the Hot Rod or REST endpoints, Data Grid Server uses each security realm in turn until it finds one that can perform the authentication.
Distributed realm configuration
XML
JSON
YAML
Chapter 6. Configuring TLS/SSL encryption Copy linkLink copied to clipboard!
You can secure Data Grid Server connections using SSL/TLS encryption by configuring a keystore that contains public and private keys for Data Grid. You can also configure client certificate authentication if you require mutual TLS.
6.1. Configuring Data Grid Server keystores Copy linkLink copied to clipboard!
Add keystores to Data Grid Server and configure it to present SSL/TLS certificates that verify its identity to clients. If a security realm contains TLS/SSL identities, it encrypts any connections to Data Grid Server endpoints that use that security realm.
Prerequisites
- Create a keystore that contains certificates, or certificate chains, for Data Grid Server.
Data Grid Server supports the following keystore formats: JKS, JCEKS, PKCS12/PFX and PEM. BKS, BCFKS, and UBER are also supported if the Bouncy Castle library is present.
In production environments, server certificates should be signed by a trusted Certificate Authority, either Root or Intermediate CA.
You can use PEM files as keystores if they contain both of the following:
- A private key in PKCS#1 or PKCS#8 format.
- One or more certificates.
You should also configure PEM file keystores with an empty password (password="").
Procedure
- Open your Data Grid Server configuration for editing.
-
Add the keystore that contains SSL/TLS identities for Data Grid Server to the
$RHDG_HOME/server/confdirectory. -
Add a
server-identitiesdefinition to the Data Grid Server security realm. -
Specify the keystore file name with the
pathattribute. -
Provide the keystore password and certificate alias with the
keystore-passwordandaliasattributes. - Save the changes to your configuration.
Next steps
Configure clients with a trust store so they can verify SSL/TLS identities for Data Grid Server.
Keystore configuration
XML
JSON
YAML
6.1.1. Generating Data Grid Server keystores Copy linkLink copied to clipboard!
Configure Data Grid Server to automatically generate keystores at startup.
Automatically generated keystores:
- Should not be used in production environments.
- Are generated whenever necessary; for example, while obtaining the first connection from a client.
- Contain certificates that you can use directly in Hot Rod clients.
Procedure
- Open your Data Grid Server configuration for editing.
-
Include the
generate-self-signed-certificate-hostattribute for thekeystoreelement in the server configuration. - Specify a hostname for the server certificate as the value.
- Save the changes to your configuration.
Generated keystore configuration
XML
JSON
YAML
6.1.2. Configuring TLS versions and cipher suites Copy linkLink copied to clipboard!
When using SSL/TLS encryption to secure your deployment, you can configure Data Grid Server to use specific versions of the TLS protocol as well as specific cipher suites within the protocol.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add the
engineelement to the SSL configuration for Data Grid Server. Configure Data Grid to use one or more TLS versions with the
enabled-protocolsattribute.Data Grid Server supports TLS version 1.2 and 1.3 by default. If appropriate you can set
TLSv1.3only to restrict the security protocol for client connections. Data Grid does not recommend enablingTLSv1.1because it is an older protocol with limited support and provides weak security. You should never enable any version of TLS older than 1.1.WarningIf you modify the SSL
engineconfiguration for Data Grid Server you must explicitly configure TLS versions with theenabled-protocolsattribute. Omitting theenabled-protocolsattribute allows any TLS version.<engine enabled-protocols="TLSv1.3 TLSv1.2" />
<engine enabled-protocols="TLSv1.3 TLSv1.2" />Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure Data Grid to use one or more cipher suites with the
enabled-ciphersuitesattribute (for TLSv1.2 and below) and theenabled-ciphersuites-tls13attribute (for TLSv1.3).You must ensure that you set a cipher suite that supports any protocol features you plan to use; for example
HTTP/2 ALPN.- Save the changes to your configuration.
SSL engine configuration
XML
JSON
YAML
6.2. Configuring Data Grid Server on a system with FIPS 140-2 compliant cryptography Copy linkLink copied to clipboard!
FIPS (Federal Information Processing Standards) are standards and guidelines for US federal computer systems. Although FIPS are developed for use by the US federal government, many in the private sector voluntarily use these standards.
FIPS 140-2 defines security requirements for cryptographic modules. You can configure your Data Grid Server to use encryption ciphers that adhere to the FIPS 140-2 specification by using alternative JDK security providers.
Additional resources
6.2.1. Configuring the PKCS11 cryptographic provider Copy linkLink copied to clipboard!
You can configure the PKCS11 cryptographic provider by specifying the PKCS11 keystore with the SunPKCS11-NSS-FIPS provider.
Prerequisites
-
Configure your system for FIPS mode. You can check if your system has FIPS Mode enabled by issuing the
fips-mode-setup --checkcommand in your Data Grid command-line Interface (CLI) -
Initialize the system-wide NSS database by using the
certutiltool. -
Install the JDK with the
java.securityfile configured to enable theSunPKCS11provider. This provider points to the NSS database and the SSL provider. - Install a certificate in the NSS database.
The OpenSSL provider requires a private key, but you cannot retrieve a private key from the PKCS#11 store. FIPS blocks the export of unencrypted keys from a FIPS-compliant cryptographic module, so you cannot use the OpenSSL provider for TLS when in FIPS mode. You can disable the OpenSSL provider at startup with the -Dorg.infinispan.openssl=false argument.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add a
server-identitiesdefinition to the Data Grid Server security realm. -
Specify the PKCS11 keystore with the
SunPKCS11-NSS-FIPSprovider. - Save the changes to your configuration.
Keystore configuration
XML
JSON
YAML
6.2.2. Configuring the Bouncy Castle FIPS cryptographic provider Copy linkLink copied to clipboard!
You can configure the Bouncy Castle FIPS (Federal Information Processing Standards) cryptographic provider in your Data Grid server’s configuration.
Prerequisites
-
Configure your system for FIPS mode. You can check if your system has FIPS Mode enabled by issuing the
fips-mode-setup --checkcommand in your Data Grid command-line Interface (CLI). - Create a keystore in BCFKS format that contains a certificate.
Procedure
-
Download the Bouncy Castle FIPS JAR file, and add the file to the
server/libdirectory of your Data Grid Server installation. To install Bouncy Castle, issue the
installcommand:[disconnected]> install org.bouncycastle:bc-fips:1.0.2.3
[disconnected]> install org.bouncycastle:bc-fips:1.0.2.3Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Open your Data Grid Server configuration for editing.
-
Add a
server-identitiesdefinition to the Data Grid Server security realm. -
Specify the BCFKS keystore with the
BCFIPSprovider. - Save the changes to your configuration.
Keystore configuration
XML
JSON
YAML
6.3. Configuring client certificate authentication Copy linkLink copied to clipboard!
Configure Data Grid Server to use mutual TLS to secure client connections.
You can configure Data Grid to verify client identities from certificates in a trust store in two ways:
- Require a trust store that contains only the signing certificate, which is typically a Certificate Authority (CA). Any client that presents a certificate signed by the CA can connect to Data Grid.
- Require a trust store that contains all client certificates in addition to the signing certificate. Only clients that present a signed certificate that is present in the trust store can connect to Data Grid.
Alternatively to providing trust stores you can use shared system certificates.
Prerequisites
- Create a client trust store that contains either the CA certificate or all public certificates.
- Create a keystore for Data Grid Server and configure an SSL/TLS identity.
PEM files can be used as trust stores provided they contain one or more certificates. These trust stores should be configured with an empty password: password="".
Procedure
- Open your Data Grid Server configuration for editing.
-
Add the
require-ssl-client-auth="true"parameter to yourendpointsconfiguration. -
Add the client trust store to the
$RHDG_HOME/server/confdirectory. -
Specify the
pathandpasswordattributes for thetruststoreelement in the Data Grid Server security realm configuration. -
Add the
<truststore-realm/>element to the security realm if you want Data Grid Server to authenticate each client certificate. - Save the changes to your configuration.
Next steps
- Set up authorization with client certificates in the Data Grid Server configuration if you control access with security roles and permissions.
- Configure clients to negotiate SSL/TLS connections with Data Grid Server.
Client certificate authentication configuration
XML
JSON
YAML
6.4. Configuring authorization with client certificates Copy linkLink copied to clipboard!
Enabling client certificate authentication means you do not need to specify Data Grid user credentials in client configuration, which means you must associate roles with the Common Name (CN) field in the client certificate(s).
Prerequisites
- Provide clients with a Java keystore that contains either their public certificates or part of the certificate chain, typically a public CA certificate.
- Configure Data Grid Server to perform client certificate authentication.
Procedure
- Open your Data Grid Server configuration for editing.
-
Enable the
common-name-role-mapperin the security authorization configuration. -
Assign the Common Name (
CN) from the client certificate a role with the appropriate permissions. - Save the changes to your configuration.
Client certificate authorization configuration
XML
JSON
YAML
Chapter 7. Storing Data Grid Server credentials in keystores Copy linkLink copied to clipboard!
External services require credentials to authenticate with Data Grid Server. To protect sensitive text strings such as passwords, add them to a credential keystore rather than directly in Data Grid Server configuration files.
You can then configure Data Grid Server to decrypt passwords for establishing connections with services such as databases or LDAP directories.
Plain-text passwords in $RHDG_HOME/server/conf are unencrypted. Any user account with read access to the host filesystem can view plain-text passwords.
While credential keystores are password-protected store encrypted passwords, any user account with write access to the host filesystem can tamper with the keystore itself.
To completely secure Data Grid Server credentials, you should grant read-write access only to user accounts that can configure and run Data Grid Server.
7.1. Setting up credential keystores Copy linkLink copied to clipboard!
Create keystores that encrypt credential for Data Grid Server access.
A credential keystore contains at least one alias that is associated with an encrypted password. After you create a keystore, you specify the alias in a connection configuration such as a database connection pool. Data Grid Server then decrypts the password for that alias from the keystore when the service attempts authentication.
You can create as many credential keystores with as many aliases as required.
Procedure
-
Open a terminal in
$RHDG_HOME. Create a keystore and add credentials to it with the
credentialscommand.TipBy default, keystores are of type PKCS12. Run
help credentialsfor details on changing keystore defaults.The following example shows how to create a keystore that contains an alias of "dbpassword" for the password "changeme". When you create a keystore you also specify a password for the keystore with the
-pargument.- Linux
bin/cli.sh credentials add dbpassword -c changeme -p "secret1234!"
bin/cli.sh credentials add dbpassword -c changeme -p "secret1234!"Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Microsoft Windows
bin\cli.bat credentials add dbpassword -c changeme -p "secret1234!"
bin\cli.bat credentials add dbpassword -c changeme -p "secret1234!"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Check that the alias is added to the keystore.
bin/cli.sh credentials ls -p "secret1234!" dbpassword
bin/cli.sh credentials ls -p "secret1234!" dbpasswordCopy to Clipboard Copied! Toggle word wrap Toggle overflow Configure Data Grid to use the credential keystore.
-
Specify the name and location of the credential keystore in the
credential-storesconfiguration. Provide the credential keystore and alias in the
credential-referenceconfiguration.TipAttributes in the
credential-referenceconfiguration are optional.-
storeis required only if you have multiple keystores. -
aliasis required only if the keystore contains multiple aliases.
-
-
Specify the name and location of the credential keystore in the
7.2. Credential keystore configuration Copy linkLink copied to clipboard!
This topic provides examples of credential keystores in Data Grid Server configuration.
Credential keystores
XML
JSON
YAML
Datasource connections
XML
JSON
YAML
LDAP connections
XML
JSON
YAML
Chapter 8. Configuring user roles and permissions Copy linkLink copied to clipboard!
Authorization is a security feature that requires users to have certain permissions before they can access caches or interact with Data Grid resources. You assign roles to users that provide different levels of permissions, from read-only access to full, super user privileges.
8.1. Security authorization Copy linkLink copied to clipboard!
Data Grid authorization secures your deployment by restricting user access.
User applications or clients must belong to a role that is assigned with sufficient permissions before they can perform operations on Cache Managers or caches.
For example, you configure authorization on a specific cache instance so that invoking Cache.get() requires an identity to be assigned a role with read permission while Cache.put() requires a role with write permission.
In this scenario, if a user application or client with the io role attempts to write an entry, Data Grid denies the request and throws a security exception. If a user application or client with the writer role sends a write request, Data Grid validates authorization and issues a token for subsequent operations.
Identities
Identities are security Principals of type java.security.Principal. Subjects, implemented with the javax.security.auth.Subject class, represent a group of security Principals. In other words, a Subject represents a user and all groups to which it belongs.
Identities to roles
Data Grid uses role mappers so that security principals correspond to roles, which you assign one or more permissions.
The following image illustrates how security principals correspond to roles:
8.1.1. User roles and permissions Copy linkLink copied to clipboard!
Data Grid includes a default set of roles that grant users with permissions to access data and interact with Data Grid resources.
ClusterRoleMapper is the default mechanism that Data Grid uses to associate security principals to authorization roles.
ClusterRoleMapper matches principal names to role names. A user named admin gets admin permissions automatically, a user named deployer gets deployer permissions, and so on.
| Role | Permissions | Description |
|---|---|---|
|
| ALL | Superuser with all permissions including control of the Cache Manager lifecycle. |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR, CREATE |
Can create and delete Data Grid resources in addition to |
|
| ALL_READ, ALL_WRITE, LISTEN, EXEC, MONITOR |
Has read and write access to Data Grid resources in addition to |
|
| ALL_READ, MONITOR |
Has read access to Data Grid resources in addition to |
|
| MONITOR |
Can view statistics via JMX and the |
8.1.2. Permissions Copy linkLink copied to clipboard!
Authorization roles have different permissions with varying levels of access to Data Grid. Permissions let you restrict user access to both Cache Managers and caches.
8.1.2.1. Cache Manager permissions Copy linkLink copied to clipboard!
| Permission | Function | Description |
|---|---|---|
| CONFIGURATION |
| Defines new cache configurations. |
| LISTEN |
| Registers listeners against a Cache Manager. |
| LIFECYCLE |
| Stops the Cache Manager. |
| CREATE |
| Create and remove container resources such as caches, counters, schemas, and scripts. |
| MONITOR |
|
Allows access to JMX statistics and the |
| ALL | - | Includes all Cache Manager permissions. |
8.1.2.2. Cache permissions Copy linkLink copied to clipboard!
| Permission | Function | Description |
|---|---|---|
| READ |
| Retrieves entries from a cache. |
| WRITE |
| Writes, replaces, removes, evicts data in a cache. |
| EXEC |
| Allows code execution against a cache. |
| LISTEN |
| Registers listeners against a cache. |
| BULK_READ |
| Executes bulk retrieve operations. |
| BULK_WRITE |
| Executes bulk write operations. |
| LIFECYCLE |
| Starts and stops a cache. |
| ADMIN |
| Allows access to underlying components and internal structures. |
| MONITOR |
|
Allows access to JMX statistics and the |
| ALL | - | Includes all cache permissions. |
| ALL_READ | - | Combines the READ and BULK_READ permissions. |
| ALL_WRITE | - | Combines the WRITE and BULK_WRITE permissions. |
8.1.3. Role mappers Copy linkLink copied to clipboard!
Data Grid includes a PrincipalRoleMapper API that maps security Principals in a Subject to authorization roles that you can assign to users.
8.1.3.1. Cluster role mappers Copy linkLink copied to clipboard!
ClusterRoleMapper uses a persistent replicated cache to dynamically store principal-to-role mappings for the default roles and permissions.
By default uses the Principal name as the role name and implements org.infinispan.security.MutableRoleMapper which exposes methods to change role mappings at runtime.
-
Java class:
org.infinispan.security.mappers.ClusterRoleMapper -
Declarative configuration:
<cluster-role-mapper />
8.1.3.2. Identity role mappers Copy linkLink copied to clipboard!
IdentityRoleMapper uses the Principal name as the role name.
-
Java class:
org.infinispan.security.mappers.IdentityRoleMapper -
Declarative configuration:
<identity-role-mapper />
8.1.3.3. CommonName role mappers Copy linkLink copied to clipboard!
CommonNameRoleMapper uses the Common Name (CN) as the role name if the Principal name is a Distinguished Name (DN).
For example this DN, cn=managers,ou=people,dc=example,dc=com, maps to the managers role.
-
Java class:
org.infinispan.security.mappers.CommonRoleMapper -
Declarative configuration:
<common-name-role-mapper />
8.1.3.4. Custom role mappers Copy linkLink copied to clipboard!
Custom role mappers are implementations of org.infinispan.security.PrincipalRoleMapper.
-
Declarative configuration:
<custom-role-mapper class="my.custom.RoleMapper" />
8.2. Access control list (ACL) cache Copy linkLink copied to clipboard!
Data Grid caches roles that you grant to users internally for optimal performance. Whenever you grant or deny roles to users, Data Grid flushes the ACL cache to ensure user permissions are applied correctly.
If necessary, you can disable the ACL cache or configure it with the cache-size and cache-timeout attributes.
XML
JSON
YAML
8.3. Customizing roles and permissions Copy linkLink copied to clipboard!
You can customize authorization settings in your Data Grid configuration to use role mappers with different combinations of roles and permissions.
Procedure
- Declare a role mapper and a set of custom roles and permissions in the Cache Manager configuration.
- Configure authorization for caches to restrict access based on user roles.
Custom roles and permissions configuration
XML
JSON
YAML
8.4. Configuring caches with security authorization Copy linkLink copied to clipboard!
Use authorization in your cache configuration to restrict user access. Before they can read or write cache entries, or create and delete caches, users must have a role with a sufficient level of permission.
Prerequisites
Ensure the
authorizationelement is included in thesecuritysection of thecache-containerconfiguration.Data Grid enables security authorization in the Cache Manager by default and provides a global set of roles and permissions for caches.
- If necessary, declare custom roles and permissions in the Cache Manager configuration.
Procedure
- Open your cache configuration for editing.
-
Add the
authorizationelement to caches to restrict user access based on their roles and permissions. - Save the changes to your configuration.
Authorization configuration
The following configuration shows how to use implicit authorization configuration with default roles and permissions:
XML
<distributed-cache>
<security>
<!-- Inherit authorization settings from the cache-container. --> <authorization/>
</security>
</distributed-cache>
<distributed-cache>
<security>
<!-- Inherit authorization settings from the cache-container. --> <authorization/>
</security>
</distributed-cache>
JSON
YAML
distributedCache:
security:
authorization:
enabled: true
distributedCache:
security:
authorization:
enabled: true
Custom roles and permissions
XML
<distributed-cache>
<security>
<authorization roles="admin supervisor"/>
</security>
</distributed-cache>
<distributed-cache>
<security>
<authorization roles="admin supervisor"/>
</security>
</distributed-cache>
JSON
YAML
distributedCache:
security:
authorization:
enabled: true
roles: ["admin","supervisor"]
distributedCache:
security:
authorization:
enabled: true
roles: ["admin","supervisor"]
8.5. Disabling security authorization Copy linkLink copied to clipboard!
In local development environments you can disable authorization so that users do not need roles and permissions. Disabling security authorization means that any user can access data and interact with Data Grid resources.
Procedure
- Open your Data Grid configuration for editing.
-
Remove any
authorizationelements from thesecurityconfiguration for the Cache Manager. -
Remove any
authorizationconfiguration from your caches. - Save the changes to your configuration.
Chapter 9. Enabling and configuring Data Grid statistics and JMX monitoring Copy linkLink copied to clipboard!
Data Grid can provide Cache Manager and cache statistics as well as export JMX MBeans.
9.1. Enabling statistics in remote caches Copy linkLink copied to clipboard!
Data Grid Server automatically enables statistics for the default cache manager. However, you must explicitly enable statistics for your caches.
Procedure
- Open your Data Grid configuration for editing.
-
Add the
statisticsattribute or field and specifytrueas the value. - Save and close your Data Grid configuration.
Remote cache statistics
XML
<distributed-cache statistics="true" />
<distributed-cache statistics="true" />
JSON
{
"distributed-cache": {
"statistics": "true"
}
}
{
"distributed-cache": {
"statistics": "true"
}
}
YAML
distributedCache: statistics: true
distributedCache:
statistics: true
9.2. Enabling Hot Rod client statistics Copy linkLink copied to clipboard!
Hot Rod Java clients can provide statistics that include remote cache and near-cache hits and misses as well as connection pool usage.
Procedure
- Open your Hot Rod Java client configuration for editing.
-
Set
trueas the value for thestatisticsproperty or invoke thestatistics().enable()methods. -
Export JMX MBeans for your Hot Rod client with the
jmxandjmx_domainproperties or invoke thejmxEnable()andjmxDomain()methods. - Save and close your client configuration.
Hot Rod Java client statistics
ConfigurationBuilder
hotrod-client.properties
infinispan.client.hotrod.statistics = true infinispan.client.hotrod.jmx = true infinispan.client.hotrod.jmx_domain = my.domain.org
infinispan.client.hotrod.statistics = true
infinispan.client.hotrod.jmx = true
infinispan.client.hotrod.jmx_domain = my.domain.org
9.3. Configuring Data Grid metrics Copy linkLink copied to clipboard!
Data Grid generates metrics that are compatible with the MicroProfile Metrics API.
- Gauges provide values such as the average number of nanoseconds for write operations or JVM uptime.
- Histograms provide details about operation execution times such as read, write, and remove times.
By default, Data Grid generates gauges when you enable statistics but you can also configure it to generate histograms.
Procedure
- Open your Data Grid configuration for editing.
-
Add the
metricselement or object to the cache container. -
Enable or disable gauges with the
gaugesattribute or field. -
Enable or disable histograms with the
histogramsattribute or field. - Save and close your client configuration.
Metrics configuration
XML
JSON
YAML
Verification
Data Grid Server exposes statistics through the metrics endpoint. You can collect metrics with any monitoring tool that supports the OpenMetrics format, such as Prometheus.
Data Grid metrics are provided at the vendor scope. Metrics related to the JVM are provided in the base scope.
You can retrieve metrics from Data Grid Server as follows:
curl -v http://localhost:11222/metrics
$ curl -v http://localhost:11222/metrics
To retrieve metrics in MicroProfile JSON format, do the following:
curl --header "Accept: application/json" http://localhost:11222/metrics
$ curl --header "Accept: application/json" http://localhost:11222/metrics
9.4. Registering JMX MBeans Copy linkLink copied to clipboard!
Data Grid can register JMX MBeans that you can use to collect statistics and perform administrative operations. You must also enable statistics otherwise Data Grid provides 0 values for all statistic attributes in JMX MBeans.
Procedure
- Open your Data Grid configuration for editing.
-
Add the
jmxelement or object to the cache container and specifytrueas the value for theenabledattribute or field. -
Add the
domainattribute or field and specify the domain where JMX MBeans are exposed, if required. - Save and close your client configuration.
JMX configuration
XML
JSON
YAML
9.4.1. Enabling JMX remote ports Copy linkLink copied to clipboard!
Provide unique remote JMX ports to expose Data Grid MBeans through connections in JMXServiceURL format.
Data Grid Server does not expose JMX remotely by using the single port endpoint. If you want to remotely access the Data Grid Server through JMX, you must enable a remote port.
You can enable remote JMX ports using one of the following approaches:
- Enable remote JMX ports that require authentication to one of the Data Grid Server security realms.
- Enable remote JMX ports manually using the standard Java management configuration options.
Prerequisites
-
For remote JMX with authentication, define user roles using the default security realm. Users must have
controlRolewith read/write access or themonitorRolewith read-only access to access any JMX resources.
Procedure
Start Data Grid Server with a remote JMX port enabled using one of the following ways:
Enable remote JMX through port
9999.bin/server.sh --jmx 9999
bin/server.sh --jmx 9999Copy to Clipboard Copied! Toggle word wrap Toggle overflow WarningUsing remote JMX with SSL disabled is not intended for production environments.
Pass the following system properties to Data Grid Server at startup.
bin/server.sh -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
bin/server.sh -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=falseCopy to Clipboard Copied! Toggle word wrap Toggle overflow WarningEnabling remote JMX with no authentication or SSL is not secure and not recommended in any environment. Disabling authentication and SSL allows unauthorized users to connect to your server and access the data hosted there.
9.4.2. Data Grid MBeans Copy linkLink copied to clipboard!
Data Grid exposes JMX MBeans that represent manageable resources.
org.infinispan:type=Cache- Attributes and operations available for cache instances.
org.infinispan:type=CacheManager- Attributes and operations available for cache managers, including Data Grid cache and cluster health statistics.
For a complete list of available JMX MBeans along with descriptions and available operations and attributes, see the Data Grid JMX Components documentation.
9.4.3. Registering MBeans in custom MBean servers Copy linkLink copied to clipboard!
Data Grid includes an MBeanServerLookup interface that you can use to register MBeans in custom MBeanServer instances.
Prerequisites
-
Create an implementation of
MBeanServerLookupso that thegetMBeanServer()method returns the custom MBeanServer instance. - Configure Data Grid to register JMX MBeans.
Procedure
- Open your Data Grid configuration for editing.
-
Add the
mbean-server-lookupattribute or field to the JMX configuration for the cache manager. -
Specify fully qualified name (FQN) of your
MBeanServerLookupimplementation. - Save and close your client configuration.
JMX MBean server lookup configuration
XML
JSON
YAML
Chapter 10. Adding managed datasources to Data Grid Server Copy linkLink copied to clipboard!
Optimize connection pooling and performance for JDBC database connections by adding managed datasources to your Data Grid Server configuration.
10.1. Configuring managed datasources Copy linkLink copied to clipboard!
Create managed datasources as part of your Data Grid Server configuration to optimize connection pooling and performance for JDBC database connections. You can then specify the JDNI name of the managed datasources in your caches, which centralizes JDBC connection configuration for your deployment.
Prerequisites
-
Copy database drivers to the
server/libdirectory in your Data Grid Server installation.
Procedure
- Open your Data Grid Server configuration for editing.
-
Add a new
data-sourceto thedata-sourcessection. -
Uniquely identify the datasource with the
nameattribute or field. Specify a JNDI name for the datasource with the
jndi-nameattribute or field.TipYou use the JNDI name to specify the datasource in your JDBC cache store configuration.
-
Set
trueas the value of thestatisticsattribute or field to enable statistics for the datasource through the/metricsendpoint. Provide JDBC driver details that define how to connect to the datasource in the
connection-factorysection.-
Specify the name of the database driver with the
driverattribute or field. -
Specify the JDBC connection url with the
urlattribute or field. -
Specify credentials with the
usernameandpasswordattributes or fields. - Provide any other configuration as appropriate.
-
Specify the name of the database driver with the
-
Define how Data Grid Server nodes pool and reuse connections with connection pool tuning properties in the
connection-poolsection. - Save the changes to your configuration.
Verification
Use the Data Grid Command Line Interface (CLI) to test the datasource connection, as follows:
Start a CLI session.
bin/cli.sh
bin/cli.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow List all datasources and confirm the one you created is available.
server datasource ls
server datasource lsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Test a datasource connection.
server datasource test my-datasource
server datasource test my-datasourceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Managed datasource configuration
XML
JSON
YAML
10.2. Configuring caches with JNDI names Copy linkLink copied to clipboard!
When you add a managed datasource to Data Grid Server you can add the JNDI name to a JDBC-based cache store configuration.
Prerequisites
- Configure Data Grid Server with a managed datasource.
Procedure
- Open your cache configuration for editing.
-
Add the
data-sourceelement or field to the JDBC-based cache store configuration. -
Specify the JNDI name of the managed datasource as the value of the
jndi-urlattribute. - Configure the JDBC-based cache stores as appropriate.
- Save the changes to your configuration.
JNDI name in cache configuration
XML
JSON
YAML
10.3. Connection pool tuning properties Copy linkLink copied to clipboard!
You can tune JDBC connection pools for managed datasources in your Data Grid Server configuration.
| Property | Description |
|---|---|
|
| Initial number of connections the pool should hold. |
|
| Maximum number of connections in the pool. |
|
| Minimum number of connections the pool should hold. |
|
|
Maximum time in milliseconds to block while waiting for a connection before throwing an exception. This will never throw an exception if creating a new connection takes an inordinately long period of time. Default is |
|
|
Time in milliseconds between background validation runs. A duration of |
|
|
Connections idle for longer than this time, specified in milliseconds, are validated before being acquired (foreground validation). A duration of |
|
| Time in minutes a connection has to be idle before it can be removed. |
|
| Time in milliseconds a connection has to be held before a leak warning. |
Chapter 11. Setting up Data Grid cluster transport Copy linkLink copied to clipboard!
Data Grid requires a transport layer so nodes can automatically join and leave clusters. The transport layer also enables Data Grid nodes to replicate or distribute data across the network and perform operations such as re-balancing and state transfer.
11.1. Default JGroups stacks Copy linkLink copied to clipboard!
Data Grid provides default JGroups stack files, default-jgroups-*.xml, in the default-configs directory inside the infinispan-core-13.0.10.Final-redhat-00001.jar file.
You can find this JAR file in the $RHDG_HOME/lib directory.
| File name | Stack name | Description |
|---|---|---|
|
|
| Uses UDP for transport and UDP multicast for discovery. Suitable for larger clusters (over 100 nodes) or if you are using replicated caches or invalidation mode. Minimizes the number of open sockets. |
|
|
|
Uses TCP for transport and the |
|
|
|
Uses TCP for transport and |
|
|
|
Uses TCP for transport and |
|
|
|
Uses TCP for transport and |
|
|
|
Uses TCP for transport and |
11.2. Cluster discovery protocols Copy linkLink copied to clipboard!
Data Grid supports different protocols that allow nodes to automatically find each other on the network and form clusters.
There are two types of discovery mechanisms that Data Grid can use:
- Generic discovery protocols that work on most networks and do not rely on external services.
-
Discovery protocols that rely on external services to store and retrieve topology information for Data Grid clusters.
For instance the DNS_PING protocol performs discovery through DNS server records.
Running Data Grid on hosted platforms requires using discovery mechanisms that are adapted to network constraints that individual cloud providers impose.
11.2.1. PING Copy linkLink copied to clipboard!
PING, or UDPPING is a generic JGroups discovery mechanism that uses dynamic multicasting with the UDP protocol.
When joining, nodes send PING requests to an IP multicast address to discover other nodes already in the Data Grid cluster. Each node responds to the PING request with a packet that contains the address of the coordinator node and its own address. C=coordinator’s address and A=own address. If no nodes respond to the PING request, the joining node becomes the coordinator node in a new cluster.
PING configuration example
<PING num_discovery_runs="3"/>
<PING num_discovery_runs="3"/>
11.2.2. TCPPING Copy linkLink copied to clipboard!
TCPPING is a generic JGroups discovery mechanism that uses a list of static addresses for cluster members.
With TCPPING, you manually specify the IP address or hostname of each node in the Data Grid cluster as part of the JGroups stack, rather than letting nodes discover each other dynamically.
TCPPING configuration example
<TCP bind_port="7800" />
<TCPPING timeout="3000"
initial_hosts="${jgroups.tcpping.initial_hosts:hostname1[port1],hostname2[port2]}"
port_range="0"
num_initial_members="3"/>
<TCP bind_port="7800" />
<TCPPING timeout="3000"
initial_hosts="${jgroups.tcpping.initial_hosts:hostname1[port1],hostname2[port2]}"
port_range="0"
num_initial_members="3"/>
11.2.3. MPING Copy linkLink copied to clipboard!
MPING uses IP multicast to discover the initial membership of Data Grid clusters.
You can use MPING to replace TCPPING discovery with TCP stacks and use multicasing for discovery instead of static lists of initial hosts. However, you can also use MPING with UDP stacks.
MPING configuration example
<MPING mcast_addr="${jgroups.mcast_addr:228.6.7.8}"
mcast_port="${jgroups.mcast_port:46655}"
num_discovery_runs="3"
ip_ttl="${jgroups.udp.ip_ttl:2}"/>
<MPING mcast_addr="${jgroups.mcast_addr:228.6.7.8}"
mcast_port="${jgroups.mcast_port:46655}"
num_discovery_runs="3"
ip_ttl="${jgroups.udp.ip_ttl:2}"/>
11.2.4. TCPGOSSIP Copy linkLink copied to clipboard!
Gossip routers provide a centralized location on the network from which your Data Grid cluster can retrieve addresses of other nodes.
You inject the address (IP:PORT) of the Gossip router into Data Grid nodes as follows:
-
Pass the address as a system property to the JVM; for example,
-DGossipRouterAddress="10.10.2.4[12001]". - Reference that system property in the JGroups configuration file.
Gossip router configuration example
<TCP bind_port="7800" />
<TCPGOSSIP timeout="3000"
initial_hosts="${GossipRouterAddress}"
num_initial_members="3" />
<TCP bind_port="7800" />
<TCPGOSSIP timeout="3000"
initial_hosts="${GossipRouterAddress}"
num_initial_members="3" />
11.2.5. JDBC_PING Copy linkLink copied to clipboard!
JDBC_PING uses shared databases to store information about Data Grid clusters. This protocol supports any database that can use a JDBC connection.
Nodes write their IP addresses to the shared database so joining nodes can find the Data Grid cluster on the network. When nodes leave Data Grid clusters, they delete their IP addresses from the shared database.
JDBC_PING configuration example
<JDBC_PING connection_url="jdbc:mysql://localhost:3306/database_name"
connection_username="user"
connection_password="password"
connection_driver="com.mysql.jdbc.Driver"/>
<JDBC_PING connection_url="jdbc:mysql://localhost:3306/database_name"
connection_username="user"
connection_password="password"
connection_driver="com.mysql.jdbc.Driver"/>
Add the appropriate JDBC driver to the classpath so Data Grid can use JDBC_PING.
11.2.6. DNS_PING Copy linkLink copied to clipboard!
JGroups DNS_PING queries DNS servers to discover Data Grid cluster members in Kubernetes environments such as OKD and Red Hat OpenShift.
DNS_PING configuration example
<dns.DNS_PING dns_query="myservice.myproject.svc.cluster.local" />
<dns.DNS_PING dns_query="myservice.myproject.svc.cluster.local" />
11.2.7. Cloud discovery protocols Copy linkLink copied to clipboard!
Data Grid includes default JGroups stacks that use discovery protocol implementations that are specific to cloud providers.
| Discovery protocol | Default stack file | Artifact | Version |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Providing dependencies for cloud discovery protocols
To use NATIVE_S3_PING, GOOGLE_PING2, or AZURE_PING cloud discovery protocols, you need to provide dependent libraries to Data Grid.
Procedure
- Download the artifact JAR file and all dependencies.
Add the artifact JAR file and all dependencies to the
$RHDG_HOME/server/libdirectory of your Data Grid Server installation.For more details see the Downloading artifacts for JGroups cloud discover protocols for Data Grid Server (Red Hat knowledgebase article)
You can then configure the cloud discovery protocol as part of a JGroups stack file or with system properties.
11.3. Using the default JGroups stacks Copy linkLink copied to clipboard!
Data Grid uses JGroups protocol stacks so nodes can send each other messages on dedicated cluster channels.
Data Grid provides preconfigured JGroups stacks for UDP and TCP protocols. You can use these default stacks as a starting point for building custom cluster transport configuration that is optimized for your network requirements.
Procedure
Do one of the following to use one of the default JGroups stacks:
Use the
stackattribute in yourinfinispan.xmlfile.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
cluster-stackargument to set the JGroups stack file when Data Grid Server starts:bin/server.sh --cluster-stack=udp
bin/server.sh --cluster-stack=udpCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Data Grid logs the following message to indicate which stack it uses:
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack udp
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack udp
11.4. Customizing JGroups stacks Copy linkLink copied to clipboard!
Adjust and tune properties to create a cluster transport configuration that works for your network requirements.
Data Grid provides attributes that let you extend the default JGroups stacks for easier configuration. You can inherit properties from the default stacks while combining, removing, and replacing other properties.
Procedure
-
Create a new JGroups stack declaration in your
infinispan.xmlfile. -
Add the
extendsattribute and specify a JGroups stack to inherit properties from. -
Use the
stack.combineattribute to modify properties for protocols configured in the inherited stack. -
Use the
stack.positionattribute to define the location for your custom stack. Specify the stack name as the value for the
stackattribute in thetransportconfiguration.For example, you might evaluate using a Gossip router and symmetric encryption with the default TCP stack as follows:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check Data Grid logs to ensure it uses the stack.
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack my-stack
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack my-stackCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Reference
- JGroups cluster transport configuration for Data Grid 8.x (Red Hat knowledgebase article)
11.4.1. Inheritance attributes Copy linkLink copied to clipboard!
When you extend a JGroups stack, inheritance attributes let you adjust protocols and properties in the stack you are extending.
-
stack.positionspecifies protocols to modify. stack.combineuses the following values to extend JGroups stacks:Expand Value Description COMBINEOverrides protocol properties.
REPLACEReplaces protocols.
INSERT_AFTERAdds a protocol into the stack after another protocol. Does not affect the protocol that you specify as the insertion point.
Protocols in JGroups stacks affect each other based on their location in the stack. For example, you should put a protocol such as
NAKACK2after theSYM_ENCRYPTorASYM_ENCRYPTprotocol so thatNAKACK2is secured.INSERT_BEFOREInserts a protocols into the stack before another protocol. Affects the protocol that you specify as the insertion point.
REMOVERemoves protocols from the stack.
11.5. Using JGroups system properties Copy linkLink copied to clipboard!
Pass system properties to Data Grid at startup to tune cluster transport.
Procedure
-
Use
-D<property-name>=<property-value>arguments to set JGroups system properties as required.
For example, set a custom bind port and IP address as follows:
bin/server.sh -Djgroups.bind.port=1234 -Djgroups.bind.address=192.0.2.0
bin/server.sh -Djgroups.bind.port=1234 -Djgroups.bind.address=192.0.2.0
11.5.1. Cluster transport properties Copy linkLink copied to clipboard!
Use the following properties to customize JGroups cluster transport.
| System Property | Description | Default Value | Required/Optional |
|---|---|---|---|
|
| Bind address for cluster transport. |
| Optional |
|
| Bind port for the socket. |
| Optional |
|
| IP address for multicast, both discovery and inter-cluster communication. The IP address must be a valid "class D" address that is suitable for IP multicast. |
| Optional |
|
| Port for the multicast socket. |
| Optional |
|
| Time-to-live (TTL) for IP multicast packets. The value defines the number of network hops a packet can make before it is dropped. | 2 | Optional |
|
| Minimum number of threads for the thread pool. | 0 | Optional |
|
| Maximum number of threads for the thread pool. | 200 | Optional |
|
| Maximum number of milliseconds to wait for join requests to succeed. | 2000 | Optional |
|
| Number of times a thread pool needs to be full before a thread dump is logged. | 10000 | Optional |
11.5.2. System properties for cloud discovery protocols Copy linkLink copied to clipboard!
Use the following properties to configure JGroups discovery protocols for hosted platforms.
11.5.2.1. Amazon EC2 Copy linkLink copied to clipboard!
System properties for configuring NATIVE_S3_PING.
| System Property | Description | Default Value | Required/Optional |
|---|---|---|---|
|
| Name of the Amazon S3 region. | No default value. | Optional |
|
| Name of the Amazon S3 bucket. The name must exist and be unique. | No default value. | Optional |
11.5.2.2. Google Cloud Platform Copy linkLink copied to clipboard!
System properties for configuring GOOGLE_PING2.
| System Property | Description | Default Value | Required/Optional |
|---|---|---|---|
|
| Name of the Google Compute Engine bucket. The name must exist and be unique. | No default value. | Required |
11.5.2.3. Azure Copy linkLink copied to clipboard!
System properties for AZURE_PING.
| System Property | Description | Default Value | Required/Optional |
|---|---|---|---|
|
| Name of the Azure storage account. The name must exist and be unique. | No default value. | Required |
|
| Name of the Azure storage access key. | No default value. | Required |
|
| Valid DNS name of the container that stores ping information. | No default value. | Required |
11.5.2.4. OpenShift Copy linkLink copied to clipboard!
System properties for DNS_PING.
| System Property | Description | Default Value | Required/Optional |
|---|---|---|---|
|
| Sets the DNS record that returns cluster members. | No default value. | Required |
11.6. Using inline JGroups stacks Copy linkLink copied to clipboard!
You can insert complete JGroups stack definitions into infinispan.xml files.
Procedure
Embed a custom JGroups stack declaration in your
infinispan.xmlfile.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.7. Using external JGroups stacks Copy linkLink copied to clipboard!
Reference external files that define custom JGroups stacks in infinispan.xml files.
Procedure
Add custom JGroups stack files to the
$RHDG_HOME/server/confdirectory.Alternatively you can specify an absolute path when you declare the external stack file.
Reference the external stack file with the
stack-fileelement.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
11.8. Encrypting cluster transport Copy linkLink copied to clipboard!
Secure cluster transport so that nodes communicate with encrypted messages. You can also configure Data Grid clusters to perform certificate authentication so that only nodes with valid identities can join.
11.8.1. Securing cluster transport with TLS identities Copy linkLink copied to clipboard!
Add SSL/TLS identities to a Data Grid Server security realm and use them to secure cluster transport. Nodes in the Data Grid Server cluster then exchange SSL/TLS certificates to encrypt JGroups messages, including RELAY messages if you configure cross-site replication.
Prerequisites
- Install a Data Grid Server cluster.
Procedure
Create a TLS keystore that contains a single certificate to identify Data Grid Server.
You can also use a PEM file if it contains a private key in PKCS#1 or PKCS#8 format, a certificate, and has an empty password:
password="".NoteIf the certificate in the keystore is not signed by a public certificate authority (CA) then you must also create a trust store that contains either the signing certificate or the public key.
-
Add the keystore to the
$RHDG_HOME/server/confdirectory. Add the keystore to a new security realm in your Data Grid Server configuration.
ImportantYou should create dedicated keystores and security realms so that Data Grid Server endpoints do not use the same security realm as cluster transport.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure cluster transport to use the security realm by specifying the name of the security realm with the
server:security-realmattribute.<infinispan> <cache-container> <transport server:security-realm="cluster-transport"/> </cache-container> </infinispan><infinispan> <cache-container> <transport server:security-realm="cluster-transport"/> </cache-container> </infinispan>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
When you start Data Grid Server, the following log message indicates that the cluster is using the security realm for cluster transport:
[org.infinispan.SERVER] ISPN080060: SSL Transport using realm <security_realm_name>
[org.infinispan.SERVER] ISPN080060: SSL Transport using realm <security_realm_name>
11.8.2. JGroups encryption protocols Copy linkLink copied to clipboard!
To secure cluster traffic, you can configure Data Grid nodes to encrypt JGroups message payloads with secret keys.
Data Grid nodes can obtain secret keys from either:
- The coordinator node (asymmetric encryption).
- A shared keystore (symmetric encryption).
Retrieving secret keys from coordinator nodes
You configure asymmetric encryption by adding the ASYM_ENCRYPT protocol to a JGroups stack in your Data Grid configuration. This allows Data Grid clusters to generate and distribute secret keys.
When using asymmetric encryption, you should also provide keystores so that nodes can perform certificate authentication and securely exchange secret keys. This protects your cluster from man-in-the-middle (MitM) attacks.
Asymmetric encryption secures cluster traffic as follows:
- The first node in the Data Grid cluster, the coordinator node, generates a secret key.
- A joining node performs certificate authentication with the coordinator to mutually verify identity.
- The joining node requests the secret key from the coordinator node. That request includes the public key for the joining node.
- The coordinator node encrypts the secret key with the public key and returns it to the joining node.
- The joining node decrypts and installs the secret key.
- The node joins the cluster, encrypting and decrypting messages with the secret key.
Retrieving secret keys from shared keystores
You configure symmetric encryption by adding the SYM_ENCRYPT protocol to a JGroups stack in your Data Grid configuration. This allows Data Grid clusters to obtain secret keys from keystores that you provide.
- Nodes install the secret key from a keystore on the Data Grid classpath at startup.
- Node join clusters, encrypting and decrypting messages with the secret key.
Comparison of asymmetric and symmetric encryption
ASYM_ENCRYPT with certificate authentication provides an additional layer of encryption in comparison with SYM_ENCRYPT. You provide keystores that encrypt the requests to coordinator nodes for the secret key. Data Grid automatically generates that secret key and handles cluster traffic, while letting you specify when to generate secret keys. For example, you can configure clusters to generate new secret keys when nodes leave. This ensures that nodes cannot bypass certificate authentication and join with old keys.
SYM_ENCRYPT, on the other hand, is faster than ASYM_ENCRYPT because nodes do not need to exchange keys with the cluster coordinator. A potential drawback to SYM_ENCRYPT is that there is no configuration to automatically generate new secret keys when cluster membership changes. Users are responsible for generating and distributing the secret keys that nodes use to encrypt cluster traffic.
11.8.3. Securing cluster transport with asymmetric encryption Copy linkLink copied to clipboard!
Configure Data Grid clusters to generate and distribute secret keys that encrypt JGroups messages.
Procedure
- Create a keystore with certificate chains that enables Data Grid to verify node identity.
Place the keystore on the classpath for each node in the cluster.
For Data Grid Server, you put the keystore in the $RHDG_HOME directory.
Add the
SSL_KEY_EXCHANGEandASYM_ENCRYPTprotocols to a JGroups stack in your Data Grid configuration, as in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
When you start your Data Grid cluster, the following log message indicates that the cluster is using the secure JGroups stack:
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
Data Grid nodes can join the cluster only if they use ASYM_ENCRYPT and can obtain the secret key from the coordinator node. Otherwise the following message is written to Data Grid logs:
[org.jgroups.protocols.ASYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
[org.jgroups.protocols.ASYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
11.8.4. Securing cluster transport with symmetric encryption Copy linkLink copied to clipboard!
Configure Data Grid clusters to encrypt JGroups messages with secret keys from keystores that you provide.
Procedure
- Create a keystore that contains a secret key.
Place the keystore on the classpath for each node in the cluster.
For Data Grid Server, you put the keystore in the $RHDG_HOME directory.
-
Add the
SYM_ENCRYPTprotocol to a JGroups stack in your Data Grid configuration.
Verification
When you start your Data Grid cluster, the following log message indicates that the cluster is using the secure JGroups stack:
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
[org.infinispan.CLUSTER] ISPN000078: Starting JGroups channel cluster with stack <encrypted_stack_name>
Data Grid nodes can join the cluster only if they use SYM_ENCRYPT and can obtain the secret key from the shared keystore. Otherwise the following message is written to Data Grid logs:
[org.jgroups.protocols.SYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
[org.jgroups.protocols.SYM_ENCRYPT] <hostname>: received message without encrypt header from <hostname>; dropping it
11.9. TCP and UDP ports for cluster traffic Copy linkLink copied to clipboard!
Data Grid uses the following ports for cluster transport messages:
| Default Port | Protocol | Description |
|---|---|---|
|
| TCP/UDP | JGroups cluster bind port |
|
| UDP | JGroups multicast |
Cross-site replication
Data Grid uses the following ports for the JGroups RELAY2 protocol:
7900- For Data Grid clusters running on OpenShift.
7800- If using UDP for traffic between nodes and TCP for traffic between clusters.
7801- If using TCP for traffic between nodes and TCP for traffic between clusters.
Chapter 12. Creating remote caches Copy linkLink copied to clipboard!
When you create remote caches at runtime, Data Grid Server synchronizes your configuration across the cluster so that all nodes have a copy. For this reason you should always create remote caches dynamically with the following mechanisms:
- Data Grid Console
- Data Grid Command Line Interface (CLI)
- Hot Rod or HTTP clients
12.1. Default Cache Manager Copy linkLink copied to clipboard!
Data Grid Server provides a default Cache Manager that controls the lifecycle of remote caches. Starting Data Grid Server automatically instantiates the Cache Manager so you can create and delete remote caches and other resources like Protobuf schema.
After you start Data Grid Server and add user credentials, you can view details about the Cache Manager and get cluster information from Data Grid Console.
-
Open
127.0.0.1:11222in any browser.
You can also get information about the Cache Manager through the Command Line Interface (CLI) or REST API:
- CLI
Run the
describecommand in the default container.[//containers/default]> describe
[//containers/default]> describeCopy to Clipboard Copied! Toggle word wrap Toggle overflow - REST
-
Open
127.0.0.1:11222/rest/v2/cache-managers/default/in any browser.
Default Cache Manager configuration
XML
JSON
YAML
12.2. Creating caches with Data Grid Console Copy linkLink copied to clipboard!
Use Data Grid Console to create remote caches in an intuitive visual interface from any web browser.
Prerequisites
-
Create a Data Grid user with
adminpermissions. - Start at least one Data Grid Server instance.
- Have a Data Grid cache configuration.
Procedure
-
Open
127.0.0.1:11222/console/in any browser. - Select Create Cache and follow the steps as Data Grid Console guides you through the process.
12.3. Creating remote caches with the Data Grid CLI Copy linkLink copied to clipboard!
Use the Data Grid Command Line Interface (CLI) to add remote caches on Data Grid Server.
Prerequisites
-
Create a Data Grid user with
adminpermissions. - Start at least one Data Grid Server instance.
- Have a Data Grid cache configuration.
Procedure
Start the CLI and enter your credentials when prompted.
bin/cli.sh
bin/cli.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use the
create cachecommand to create remote caches.For example, create a cache named "mycache" from a file named
mycache.xmlas follows:create cache --file=mycache.xml mycache
create cache --file=mycache.xml mycacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
List all remote caches with the
lscommand.ls caches mycache
ls caches mycacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow View cache configuration with the
describecommand.describe caches/mycache
describe caches/mycacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow
12.4. Creating remote caches from Hot Rod clients Copy linkLink copied to clipboard!
Use the Data Grid Hot Rod API to create remote caches on Data Grid Server from Java, C++, .NET/C#, JS clients and more.
This procedure shows you how to use Hot Rod Java clients that create remote caches on first access. You can find code examples for other Hot Rod clients in the Data Grid Tutorials.
Prerequisites
-
Create a Data Grid user with
adminpermissions. - Start at least one Data Grid Server instance.
- Have a Data Grid cache configuration.
Procedure
-
Invoke the
remoteCache()method as part of your theConfigurationBuilder. -
Set the
configurationorconfiguration_uriproperties in thehotrod-client.propertiesfile on your classpath.
ConfigurationBuilder
hotrod-client.properties
infinispan.client.hotrod.cache.another-cache.configuration=<distributed-cache name=\"another-cache\"/> infinispan.client.hotrod.cache.[my.other.cache].configuration_uri=file:///path/to/infinispan.xml
infinispan.client.hotrod.cache.another-cache.configuration=<distributed-cache name=\"another-cache\"/>
infinispan.client.hotrod.cache.[my.other.cache].configuration_uri=file:///path/to/infinispan.xml
If the name of your remote cache contains the . character, you must enclose it in square brackets when using hotrod-client.properties files.
12.5. Creating remote caches with the REST API Copy linkLink copied to clipboard!
Use the Data Grid REST API to create remote caches on Data Grid Server from any suitable HTTP client.
Prerequisites
-
Create a Data Grid user with
adminpermissions. - Start at least one Data Grid Server instance.
- Have a Data Grid cache configuration.
Procedure
-
Invoke
POSTrequests to/rest/v2/caches/<cache_name>with cache configuration in the payload.
Chapter 13. Running scripts and tasks on Data Grid Server Copy linkLink copied to clipboard!
Add tasks and scripts to Data Grid Server deployments for remote execution from the Command Line Interface (CLI) and Hot Rod or REST clients. You can implement tasks as custom Java classes or define scripts in languages such as JavaScript.
13.1. Adding tasks to Data Grid Server deployments Copy linkLink copied to clipboard!
Add your custom server task classes to Data Grid Server.
Prerequisites
Stop Data Grid Server if it is running.
Data Grid Server does not support runtime deployment of custom classes.
Procedure
Add a
META-INF/services/org.infinispan.tasks.ServerTaskfile that contains the fully qualified names of server tasks, for example:example.HelloTask
example.HelloTaskCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Package your server task implementation in a JAR file.
-
Copy the JAR file to the
$RHDG_HOME/server/libdirectory of your Data Grid Server installation. - Add your classes to the deserialization allow list in your Data Grid configuration. Alternatively set the allow list using system properties.
13.1.1. Data Grid Server tasks Copy linkLink copied to clipboard!
Data Grid Server tasks are classes that extend the org.infinispan.tasks.ServerTask interface and generally include the following method calls:
setTaskContext()-
Allows access to execution context information including task parameters, cache references on which tasks are executed, and so on. In most cases, implementations store this information locally and use it when tasks are actually executed. When using
SHAREDinstantiation mode, the task should use aThreadLocalto store theTaskContextfor concurrent invocations. getName()- Returns unique names for tasks. Clients invoke tasks with these names.
getExecutionMode()Returns the execution mode for tasks.
-
TaskExecutionMode.ONE_NODEonly the node that handles the request executes the script. Although scripts can still invoke clustered operations. This is the default. -
TaskExecutionMode.ALL_NODESData Grid uses clustered executors to run scripts across nodes. For example, server tasks that invoke stream processing need to be executed on a single node because stream processing is distributed to all nodes.
-
getInstantiationMode()Returns the instantiation mode for tasks.
-
TaskInstantiationMode.SHAREDcreates a single instance that is reused for every task execution on the same server. This is the default. -
TaskInstantiationMode.ISOLATEDcreates a new instance for every invocation.
-
call()-
Computes a result. This method is defined in the
java.util.concurrent.Callableinterface and is invoked with server tasks.
Server task implementations must adhere to service loader pattern requirements. For example, implementations must have a zero-argument constructors.
The following HelloTask class implementation provides an example task that has one parameter. It also illustrates the use of a ThreadLocal to store the TaskContext for concurrent invocations.
13.2. Adding scripts to Data Grid Server deployments Copy linkLink copied to clipboard!
Use the command line interface to add scripts to Data Grid Server.
Prerequisites
Data Grid Server stores scripts in the ___script_cache cache. If you enable cache authorization, users must have CREATE permissions to add to ___script_cache.
Assign users the deployer role at minimum if you use default authorization settings.
Procedure
Define scripts as required.
For example, create a file named
multiplication.jsthat runs on a single Data Grid server, has two parameters, and uses JavaScript to multiply a given value:// mode=local,language=javascript multiplicand * multiplier
// mode=local,language=javascript multiplicand * multiplierCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Create a CLI connection to Data Grid.
Use the
taskcommand to upload scripts, as in the following example:task upload --file=multiplication.js multiplication
task upload --file=multiplication.js multiplicationCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that your scripts are available.
ls tasks multiplication
ls tasks multiplicationCopy to Clipboard Copied! Toggle word wrap Toggle overflow
13.2.1. Data Grid Server scripts Copy linkLink copied to clipboard!
Data Grid Server scripting is based on the javax.script API and is compatible with any JVM-based ScriptEngine implementation.
Hello world
The following is a simple example that runs on a single Data Grid server, has one parameter, and uses JavaScript:
// mode=local,language=javascript,parameters=[greetee] "Hello " + greetee
// mode=local,language=javascript,parameters=[greetee]
"Hello " + greetee
When you run the preceding script, you pass a value for the greetee parameter and Data Grid returns "Hello ${value}".
13.2.1.1. Script metadata Copy linkLink copied to clipboard!
Metadata provides additional information about scripts that Data Grid Server uses when running scripts.
Script metadata are property=value pairs that you add to comments in the first lines of scripts, such as the following example:
// name=test, language=javascript // mode=local, parameters=[a,b,c]
// name=test, language=javascript
// mode=local, parameters=[a,b,c]
-
Use comment styles that match the scripting language (
//,;;,#). -
Separate
property=valuepairs with commas. - Separate values with single (') or double (") quote characters.
| Property | Description |
|---|---|
|
| Defines the execution mode and has the following values:
|
|
| Specifies the ScriptEngine that executes the script. |
|
| Specifies filename extensions as an alternative method to set the ScriptEngine. |
|
| Specifies roles that users must have to execute scripts. |
|
| Specifies an array of valid parameter names for this script. Invocations which specify parameters not included in this list cause exceptions. |
|
| Optionally sets the MediaType (MIME type) for storing data as well as parameter and return values. This property is useful for remote clients that support particular data formats only.
Currently you can set only |
13.2.1.2. Script bindings Copy linkLink copied to clipboard!
Data Grid exposes internal objects as bindings for script execution.
| Binding | Description |
|---|---|
|
| Specifies the cache against which the script is run. |
|
| Specifies the marshaller to use for serializing data to the cache. |
|
|
Specifies the |
|
| Specifies the instance of the script manager that runs the script. You can use this binding to run other scripts from a script. |
13.2.1.3. Script parameters Copy linkLink copied to clipboard!
Data Grid lets you pass named parameters as bindings for running scripts.
Parameters are name,value pairs, where name is a string and value is any value that the marshaller can interpret.
The following example script has two parameters, multiplicand and multiplier. The script takes the value of multiplicand and multiplies it with the value of multiplier.
// mode=local,language=javascript multiplicand * multiplier
// mode=local,language=javascript
multiplicand * multiplier
When you run the preceding script, Data Grid responds with the result of the expression evaluation.
13.2.2. Programmatically Creating Scripts Copy linkLink copied to clipboard!
Add scripts with the Hot Rod RemoteCache interface as in the following example:
RemoteCache<String, String> scriptCache = cacheManager.getCache("___script_cache");
scriptCache.put("multiplication.js",
"// mode=local,language=javascript\n" +
"multiplicand * multiplier\n");
RemoteCache<String, String> scriptCache = cacheManager.getCache("___script_cache");
scriptCache.put("multiplication.js",
"// mode=local,language=javascript\n" +
"multiplicand * multiplier\n");
Reference
13.3. Running scripts and tasks Copy linkLink copied to clipboard!
Use the command line interface to run tasks and scripts on Data Grid Server deployments. Alternatively you can execute scripts and tasks from Hot Rod clients.
Prerequisites
- Add scripts or tasks to Data Grid Server.
Procedure
- Create a CLI connection to Data Grid.
Use the
taskcommand to run tasks and scripts, as in the following examples:Execute a script named
multiplier.jsand specify two parameters:task exec multiplier.js -Pmultiplicand=10 -Pmultiplier=20 200.0
task exec multiplier.js -Pmultiplicand=10 -Pmultiplier=20 200.0Copy to Clipboard Copied! Toggle word wrap Toggle overflow Execute a task named
@@cache@namesto retrieve a list of all available caches:task exec @@cache@names ["___protobuf_metadata","mycache","___script_cache"]
task exec @@cache@names ["___protobuf_metadata","mycache","___script_cache"]Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Programmatic execution
-
Call the
execute()method to run scripts with the Hot RodRemoteCacheinterface, as in the following examples:
Script execution
Task execution
Chapter 14. Configuring Data Grid Server logging Copy linkLink copied to clipboard!
Data Grid Server uses Apache Log4j 2 to provide configurable logging mechanisms that capture details about the environment and record cache operations for troubleshooting purposes and root cause analysis.
14.1. Data Grid Server log files Copy linkLink copied to clipboard!
Data Grid writes server logs to the following files in the $RHDG_HOME/server/log directory:
server.log-
Messages in human readable format, including boot logs that relate to the server startup.
Data Grid creates this file when you start the server. server.log.json-
Messages in JSON format that let you parse and analyze Data Grid logs.
Data Grid creates this file when you enable theJSON-FILEappender.
14.1.1. Configuring Data Grid Server logs Copy linkLink copied to clipboard!
Data Grid uses Apache Log4j technology to write server log messages. You can configure server logs in the log4j2.xml file.
Procedure
-
Open
$RHDG_HOME/server/conf/log4j2.xmlwith any text editor. - Change server logging as appropriate.
-
Save and close
log4j2.xml.
14.1.2. Log levels Copy linkLink copied to clipboard!
Log levels indicate the nature and severity of messages.
| Log level | Description |
|---|---|
|
| Fine-grained debug messages, capturing the flow of individual requests through the application. |
|
| Messages for general debugging, not related to an individual request. |
|
| Messages about the overall progress of applications, including lifecycle events. |
|
| Events that can lead to error or degrade performance. |
|
| Error conditions that might prevent operations or activities from being successful but do not prevent applications from running. |
|
| Events that could cause critical service failure and application shutdown. |
In addition to the levels of individual messages presented above, the configuration allows two more values: ALL to include all messages, and OFF to exclude all messages.
14.1.3. Data Grid logging categories Copy linkLink copied to clipboard!
Data Grid provides categories for INFO, WARN, ERROR, FATAL level messages that organize logs by functional area.
org.infinispan.CLUSTER- Messages specific to Data Grid clustering that include state transfer operations, rebalancing events, partitioning, and so on.
org.infinispan.CONFIG- Messages specific to Data Grid configuration.
org.infinispan.CONTAINER- Messages specific to the data container that include expiration and eviction operations, cache listener notifications, transactions, and so on.
org.infinispan.PERSISTENCE- Messages specific to cache loaders and stores.
org.infinispan.SECURITY- Messages specific to Data Grid security.
org.infinispan.SERVER- Messages specific to Data Grid servers.
org.infinispan.XSITE- Messages specific to cross-site replication operations.
14.1.4. Log appenders Copy linkLink copied to clipboard!
Log appenders define how Data Grid Server records log messages.
- CONSOLE
-
Write log messages to the host standard out (
stdout) or standard error (stderr) stream.
Uses theorg.apache.logging.log4j.core.appender.ConsoleAppenderclass by default. - FILE
-
Write log messages to a file.
Uses theorg.apache.logging.log4j.core.appender.RollingFileAppenderclass by default. - JSON-FILE
-
Write log messages to a file in JSON format.
Uses theorg.apache.logging.log4j.core.appender.RollingFileAppenderclass by default.
14.1.5. Log pattern formatters Copy linkLink copied to clipboard!
The CONSOLE and FILE appenders use a PatternLayout to format the log messages according to a pattern.
An example is the default pattern in the FILE appender:%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p (%t) [%c{1}] %m%throwable%n
-
%d{yyyy-MM-dd HH:mm:ss,SSS}adds the current time and date. -
%-5pspecifies the log level, aligned to the right. -
%tadds the name of the current thread. -
%c{1}adds the short name of the logging category. -
%madds the log message. -
%throwableadds the exception stack trace. -
%nadds a new line.
Patterns are fully described in the PatternLayout documentation .
14.1.6. Enabling the JSON log handler Copy linkLink copied to clipboard!
Data Grid Server provides a log handler to write messages in JSON format.
Prerequisites
-
Stop Data Grid Server if it is running.
You cannot dynamically enable log handlers.
Procedure
-
Open
$RHDG_HOME/server/conf/log4j2.xmlwith any text editor. Uncomment the
JSON-FILEappender and comment out theFILEappender:<!--<AppenderRef ref="FILE"/>--> <AppenderRef ref="JSON-FILE"/>
<!--<AppenderRef ref="FILE"/>--> <AppenderRef ref="JSON-FILE"/>Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Optionally configure the JSON appender and JSON layout as required.
-
Save and close
log4j2.xml.
When you start Data Grid, it writes each log message as a JSON map in the following file:$RHDG_HOME/server/log/server.log.json
14.2. Access logs Copy linkLink copied to clipboard!
Access logs record all inbound client requests for Hot Rod and REST endpoints to files in the $RHDG_HOME/server/log directory.
org.infinispan.HOTROD_ACCESS_LOG-
Logging category that writes Hot Rod access messages to a
hotrod-access.logfile. org.infinispan.REST_ACCESS_LOG-
Logging category that writes REST access messages to a
rest-access.logfile.
14.2.1. Enabling access logs Copy linkLink copied to clipboard!
To record Hot Rod and REST endpoint access messages, you need to enable the logging categories in log4j2.xml.
Procedure
-
Open
$RHDG_HOME/server/conf/log4j2.xmlwith any text editor. -
Change the level for the
org.infinispan.HOTROD_ACCESS_LOGandorg.infinispan.REST_ACCESS_LOGlogging categories toTRACE. -
Save and close
log4j2.xml.
<Logger name="org.infinispan.HOTROD_ACCESS_LOG" additivity="false" level="TRACE"> <AppenderRef ref="HR-ACCESS-FILE"/> </Logger>
<Logger name="org.infinispan.HOTROD_ACCESS_LOG" additivity="false" level="TRACE">
<AppenderRef ref="HR-ACCESS-FILE"/>
</Logger>
14.2.2. Access log properties Copy linkLink copied to clipboard!
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
%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 - [DD/MM/YYYY:HH:MM:SS +0000] "PUT /rest/v2/caches/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}.
14.3. Audit logs Copy linkLink copied to clipboard!
Audit logs let you track changes to your Data Grid Server deployment so you know when changes occur and which users make them. Enable and configure audit logging to record server configuration events and administrative operations.
org.infinispan.AUDIT-
Logging category that writes security audit messages to an
audit.logfile in the$RHDG_HOME/server/logdirectory.
14.3.1. Enabling audit logging Copy linkLink copied to clipboard!
To record security audit messages, you need to enable the logging category in log4j2.xml.
Procedure
-
Open
$RHDG_HOME/server/conf/log4j2.xmlwith any text editor. -
Change the level for the
org.infinispan.AUDITlogging category toINFO. -
Save and close
log4j2.xml.
<!-- Set to INFO to enable audit logging --> <Logger name="org.infinispan.AUDIT" additivity="false" level="INFO"> <AppenderRef ref="AUDIT-FILE"/> </Logger>
<!-- Set to INFO to enable audit logging -->
<Logger name="org.infinispan.AUDIT" additivity="false" level="INFO">
<AppenderRef ref="AUDIT-FILE"/>
</Logger>
14.3.2. Configuring audit logging appenders Copy linkLink copied to clipboard!
Apache Log4j provides different appenders that you can use to send audit messages to a destination other than the default log file. For instance, if you want to send audit logs to a syslog daemon, JDBC database, or Apache Kafka server, you can configure an appender in log4j2.xml.
Procedure
-
Open
$RHDG_HOME/server/conf/log4j2.xmlwith any text editor. Comment or remove the default
AUDIT-FILErolling file appender.<!--RollingFile name="AUDIT-FILE" ... </RollingFile-->
<!--RollingFile name="AUDIT-FILE" ... </RollingFile-->Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the desired logging appender for audit messages.
For example, you could add a logging appender for a Kafka server as follows:
<Kafka name="AUDIT-KAFKA" topic="audit"> <PatternLayout pattern="%date %message"/> <Property name="bootstrap.servers">localhost:9092</Property> </Kafka>
<Kafka name="AUDIT-KAFKA" topic="audit"> <PatternLayout pattern="%date %message"/> <Property name="bootstrap.servers">localhost:9092</Property> </Kafka>Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Save and close
log4j2.xml.
14.3.3. Using custom audit logging implementations Copy linkLink copied to clipboard!
You can create custom implementations of the org.infinispan.security.AuditLogger API if configuring Log4j appenders does not meet your needs.
Prerequisites
-
Implement
org.infinispan.security.AuditLoggeras required and package it in a JAR file.
Procedure
-
Add your JAR to the
server/libdirectory in your Data Grid Server installation. Specify the fully qualified class name of your custom audit logger as the value for the
audit-loggerattribute on theauthorizationelement in your cache container security configuration.For example, the following configuration defines
my.package.CustomAuditLoggeras the class for logging audit messages:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Chapter 15. Performing rolling upgrades for Data Grid Server clusters Copy linkLink copied to clipboard!
Perform rolling upgrades of your Data Grid clusters to change between versions without downtime or data loss and migrate data over the Hot Rod protocol.
15.1. Setting up target Data Grid clusters Copy linkLink copied to clipboard!
Create a cluster that uses the Data Grid version to which you plan to upgrade and then connect the source cluster to the target cluster using a remote cache store.
Prerequisites
- Install Data Grid Server nodes with the desired version for your target cluster.
Ensure the network properties for the target cluster do not overlap with those for the source cluster. You should specify unique names for the target and source clusters in the JGroups transport configuration. Depending on your environment you can also use different network interfaces and port offsets to separate the target and source clusters.
Procedure
Create a remote cache store configuration, in JSON format, that allows the target cluster to connect to the source cluster.
Remote cache stores on the target cluster use the Hot Rod protocol to retrieve data from the source cluster.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the Data Grid Command Line Interface (CLI) or REST API to add the remote cache store configuration to the target cluster so it can connect to the source cluster.
CLI: Use the
migrate cluster connectcommand on the target cluster.[//containers/default]> migrate cluster connect -c myCache --file=remote-store.json
[//containers/default]> migrate cluster connect -c myCache --file=remote-store.jsonCopy to Clipboard Copied! Toggle word wrap Toggle overflow REST API: Invoke a POST request that includes the remote store configuration in the payload with the
rolling-upgrade/source-connectionmethod.POST /v2/caches/myCache/rolling-upgrade/source-connection
POST /v2/caches/myCache/rolling-upgrade/source-connectionCopy to Clipboard Copied! Toggle word wrap Toggle overflow
- Repeat the preceding step for each cache that you want to migrate.
Switch clients over to the target cluster, so it starts handling all requests.
- Update client configuration with the location of the target cluster.
- Restart clients.
15.2. Synchronizing data to target clusters Copy linkLink copied to clipboard!
When you set up a target Data Grid cluster and connect it to a source cluster, the target cluster can handle client requests using a remote cache store and load data on demand. To completely migrate data to the target cluster, so you can decommission the source cluster, you can synchronize data. This operation reads data from the source cluster and writes it to the target cluster. Data migrates to all nodes in the target cluster in parallel, with each node receiving a subset of the data. You must perform the synchronization for each cache that you want to migrate to the target cluster.
Prerequisites
- Set up a target cluster with the appropriate Data Grid version.
Procedure
Start synchronizing each cache that you want to migrate to the target cluster with the Data Grid Command Line Interface (CLI) or REST API.
CLI: Use the
migrate cluster synchronizecommand.migrate cluster synchronize -c myCache
migrate cluster synchronize -c myCacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow REST API: Use the
?action=sync-dataparameter with a POST request.POST /v2/caches/myCache?action=sync-data
POST /v2/caches/myCache?action=sync-dataCopy to Clipboard Copied! Toggle word wrap Toggle overflow When the operation completes, Data Grid responds with the total number of entries copied to the target cluster.
Disconnect each node in the target cluster from the source cluster.
CLI: Use the
migrate cluster disconnectcommand.migrate cluster disconnect -c myCache
migrate cluster disconnect -c myCacheCopy to Clipboard Copied! Toggle word wrap Toggle overflow REST API: Invoke a DELETE request.
DELETE /v2/caches/myCache/rolling-upgrade/source-connection
DELETE /v2/caches/myCache/rolling-upgrade/source-connectionCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Next steps
After you synchronize all data from the source cluster, the rolling upgrade process is complete. You can now decommission the source cluster.
Chapter 16. Troubleshooting Data Grid Server deployments Copy linkLink copied to clipboard!
Gather diagnostic information about Data Grid Server deployments and perform troubleshooting steps to resolve issues.
16.1. Getting diagnostic reports from Data Grid Server Copy linkLink copied to clipboard!
Data Grid Server provides aggregated reports in tar.gz archives that contain diagnostic information about server instances and host systems. The report provides details about CPU, memory, open files, network sockets and routing, threads, in addition to configuration and log files.
Procedure
- Create a CLI connection to Data Grid Server.
Use the
server reportcommand to download atar.gzarchive:server report Downloaded report 'infinispan-<hostname>-<timestamp>-report.tar.gz'
server report Downloaded report 'infinispan-<hostname>-<timestamp>-report.tar.gz'Copy to Clipboard Copied! Toggle word wrap Toggle overflow The command responds with the name of the report, as in the following example:
Downloaded report 'infinispan-<hostname>-<timestamp>-report.tar.gz'
Downloaded report 'infinispan-<hostname>-<timestamp>-report.tar.gz'Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Move the
tar.gzfile to a suitable location on your filesystem. -
Extract the
tar.gzfile with any archiving tool.
16.2. Changing Data Grid Server logging configuration at runtime Copy linkLink copied to clipboard!
Modify the logging configuration for Data Grid Server at runtime to temporarily adjust logging to troubleshoot issues and perform root cause analysis.
Modifying the logging configuration through the CLI is a runtime-only operation, which means that changes:
-
Are not saved to the
log4j2.xmlfile. Restarting server nodes or the entire cluster resets the logging configuration to the default properties in thelog4j2.xmlfile. - Apply only to the nodes in the cluster when you invoke the CLI. Nodes that join the cluster after you change the logging configuration use the default properties.
Procedure
- Create a CLI connection to Data Grid Server.
Use the
loggingto make the required adjustments.List all appenders defined on the server:
logging list-appenders
logging list-appendersCopy to Clipboard Copied! Toggle word wrap Toggle overflow The command provides a JSON response such as the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow List all logger configurations defined on the server:
logging list-loggers
logging list-loggersCopy to Clipboard Copied! Toggle word wrap Toggle overflow The command provides a JSON response such as the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add and modify logger configurations with the
setsubcommandFor example, the following command sets the logging level for the
org.infinispanpackage toDEBUG:logging set --level=DEBUG org.infinispan
logging set --level=DEBUG org.infinispanCopy to Clipboard Copied! Toggle word wrap Toggle overflow Remove existing logger configurations with the
removesubcommand.For example, the following command removes the
org.infinispanlogger configuration, which means the root configuration is used instead:logging remove org.infinispan
logging remove org.infinispanCopy to Clipboard Copied! Toggle word wrap Toggle overflow
16.3. Gathering resource statistics from the CLI Copy linkLink copied to clipboard!
You can inspect server-collected statistics for some Data Grid Server resources with the stats command.
Use the stats command either from the context of a resource that provides statistics (containers, caches) or with a path to such a resource:
stats
stats
stats /containers/default/caches/mycache
stats /containers/default/caches/mycache
16.4. Accessing cluster health via REST Copy linkLink copied to clipboard!
Get Data Grid cluster health via the REST API.
Procedure
Invoke a
GETrequest to retrieve cluster health.GET /rest/v2/cache-managers/{cacheManagerName}/healthGET /rest/v2/cache-managers/{cacheManagerName}/healthCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Data Grid responds with a JSON document such as the following:
Get cache manager status as follows:
GET /rest/v2/cache-managers/{cacheManagerName}/health/status
GET /rest/v2/cache-managers/{cacheManagerName}/health/status
Reference
See the REST v2 (version 2) API documentation for more information.
16.5. Accessing cluster health via JMX Copy linkLink copied to clipboard!
Retrieve Data Grid cluster health statistics via JMX.
Procedure
Connect to Data Grid server using any JMX capable tool such as JConsole and navigate to the following object:
org.infinispan:type=CacheManager,name="default",component=CacheContainerHealth
org.infinispan:type=CacheManager,name="default",component=CacheContainerHealthCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Select available MBeans to retrieve cluster health statistics.
Chapter 17. Reference Copy linkLink copied to clipboard!
17.1. Data Grid Server 8.3.1 Readme Copy linkLink copied to clipboard!
Information about Data Grid Server 13.0.10.Final-redhat-00001 distribution.
17.1.1. Requirements Copy linkLink copied to clipboard!
Data Grid Server requires JDK 11 or later.
17.1.2. Starting servers Copy linkLink copied to clipboard!
Use the server script to run Data Grid Server instances.
Unix / Linux
$RHDG_HOME/bin/server.sh
$RHDG_HOME/bin/server.sh
Windows
$RHDG_HOME\bin\server.bat
$RHDG_HOME\bin\server.bat
Include the --help or -h option to view command arguments.
17.1.3. Stopping servers Copy linkLink copied to clipboard!
Use the shutdown command with the CLI to perform a graceful shutdown.
Alternatively, enter Ctrl-C from the terminal to interrupt the server process or kill it via the TERM signal.
17.1.4. Configuration Copy linkLink copied to clipboard!
Server configuration extends Data Grid configuration with the following server-specific elements:
cache-container- Defines cache containers for managing cache lifecycles.
endpoints- Enables and configures endpoint connectors for client protocols.
security- Configures endpoint security realms.
socket-bindings- Maps endpoint connectors to interfaces and ports.
The default configuration file is $RHDG_HOME/server/conf/infinispan.xml.
Use different configuration files with the -c argument, as in the following example that starts a server without clustering capabilities:
Unix / Linux
$RHDG_HOME/bin/server.sh -c infinispan-local.xml
$RHDG_HOME/bin/server.sh -c infinispan-local.xml
Windows
$RHDG_HOME\bin\server.bat -c infinispan-local.xml
$RHDG_HOME\bin\server.bat -c infinispan-local.xml
17.1.5. Bind address Copy linkLink copied to clipboard!
Data Grid Server binds to the loopback IP address localhost on your network by default.
Use the -b argument to set a different IP address, as in the following example that binds to all network interfaces:
Unix / Linux
$RHDG_HOME/bin/server.sh -b 0.0.0.0
$RHDG_HOME/bin/server.sh -b 0.0.0.0
Windows
$RHDG_HOME\bin\server.bat -b 0.0.0.0
$RHDG_HOME\bin\server.bat -b 0.0.0.0
17.1.6. Bind port Copy linkLink copied to clipboard!
Data Grid Server listens on port 11222 by default.
Use the -p argument to set an alternative port:
Unix / Linux
$RHDG_HOME/bin/server.sh -p 30000
$RHDG_HOME/bin/server.sh -p 30000
Windows
$RHDG_HOME\bin\server.bat -p 30000
$RHDG_HOME\bin\server.bat -p 30000
17.1.7. Clustering address Copy linkLink copied to clipboard!
Data Grid Server configuration defines cluster transport so multiple instances on the same network discover each other and automatically form clusters.
Use the -k argument to change the IP address for cluster traffic:
Unix / Linux
$RHDG_HOME/bin/server.sh -k 192.168.1.100
$RHDG_HOME/bin/server.sh -k 192.168.1.100
Windows
$RHDG_HOME\bin\server.bat -k 192.168.1.100
$RHDG_HOME\bin\server.bat -k 192.168.1.100
17.1.8. Cluster stacks Copy linkLink copied to clipboard!
JGroups stacks configure the protocols for cluster transport. Data Grid Server uses the tcp stack by default.
Use alternative cluster stacks with the -j argument, as in the following example that uses UDP for cluster transport:
Unix / Linux
$RHDG_HOME/bin/server.sh -j udp
$RHDG_HOME/bin/server.sh -j udp
Windows
$RHDG_HOME\bin\server.bat -j udp
$RHDG_HOME\bin\server.bat -j udp
17.1.9. Authentication Copy linkLink copied to clipboard!
Data Grid Server requires authentication.
Create a username and password with the CLI as follows:
Unix / Linux
$RHDG_HOME/bin/cli.sh user create username -p "qwer1234!"
$RHDG_HOME/bin/cli.sh user create username -p "qwer1234!"
Windows
$RHDG_HOME\bin\cli.bat user create username -p "qwer1234!"
$RHDG_HOME\bin\cli.bat user create username -p "qwer1234!"
17.1.10. Server home directory Copy linkLink copied to clipboard!
Data Grid Server uses infinispan.server.home.path to locate the contents of the server distribution on the host filesystem.
The server home directory, referred to as $RHDG_HOME, contains the following folders:
| Folder | Description |
|---|---|
|
| Contains scripts to start servers and CLI. |
|
|
Contains |
|
| Provides configuration examples, schemas, component licenses, and other resources. |
|
|
Contains |
|
| Provides a root folder for Data Grid Server instances. |
|
| Contains static resources for Data Grid Console. |
17.1.11. Server root directory Copy linkLink copied to clipboard!
Data Grid Server uses infinispan.server.root.path to locate configuration files and data for Data Grid Server instances.
You can create multiple server root folders in the same directory or in different directories and then specify the locations with the -s or --server-root argument, as in the following example:
Unix / Linux
$RHDG_HOME/bin/server.sh -s server2
$RHDG_HOME/bin/server.sh -s server2
Windows
$RHDG_HOME\bin\server.bat -s server2
$RHDG_HOME\bin\server.bat -s server2
Each server root directory contains the following folders:
├── server │ ├── conf │ ├── data │ ├── lib │ └── log
├── server
│ ├── conf
│ ├── data
│ ├── lib
│ └── log
| Folder | Description | System property override |
|---|---|---|
|
| Contains server configuration files. |
|
|
| Contains data files organized by container name. |
|
|
|
Contains server extension files. |
|
|
| Contains server log files. |
|
17.1.12. Logging Copy linkLink copied to clipboard!
Configure Data Grid Server logging with the log4j2.xml file in the server/conf folder.
Use the --logging-config=<path_to_logfile> argument to use custom paths, as follows:
Unix / Linux
$RHDG_HOME/bin/server.sh --logging-config=/path/to/log4j2.xml
$RHDG_HOME/bin/server.sh --logging-config=/path/to/log4j2.xml
To ensure custom paths take effect, do not use the ~ shortcut.
Windows
$RHDG_HOME\bin\server.bat --logging-config=path\to\log4j2.xml
$RHDG_HOME\bin\server.bat --logging-config=path\to\log4j2.xml