Chapter 6. Connecting to Data Grid clusters After you configure and deploy Data Grid clusters you can establish remote connections through the Data Grid Console, command line interface (CLI), Hot Rod client, or REST API. 6.1. Accessing Data Grid Console Access the console to create caches, perform adminstrative operations, and monitor your Data Grid clusters. Prerequisites Expose your Data Grid cluster on the network. Retrieve network service details. Procedure Access Data Grid Console from any browser at USDSERVICE_HOSTNAME:USDPORT . Replace USDSERVICE_HOSTNAME:USDPORT with the hostname and port where Data Grid is available on the network. 6.2. Connecting with the command line interface (CLI) Use the Data Grid CLI to connect to clusters and create caches, manipulate data, and perform administrative operations. Prerequisites Expose your Data Grid cluster on the network. Retrieve network service details. Download the native Data Grid CLI distribution from the Data Grid software downloads . Extract the .zip archive for the native Data Grid CLI distribution to your host filesystem. Procedure Start the Data Grid CLI with the network service as the value for the -c argument, for example: USD {native_cli} -c http://cluster-name-myroute.hostname.net/ Enter your Data Grid credentials when prompted. Perform CLI operations as required. Tip Press the tab key or use the --help argument to view available options and help text. Use the quit command to exit the CLI. Additional resources Using the Data Grid Command Line Interface 6.3. Connecting Hot Rod clients running on OpenShift Access remote caches with Hot Rod clients running on the same OpenShift cluster as your Data Grid cluster. Prerequisites Retrieve network service details. Procedure Specify the internal network service detail for your Data Grid cluster in the client configuration. In the following configuration examples, USDSERVICE_HOSTNAME:USDPORT denotes the hostname and port that allows access to your Data Grid cluster. Specify your credentials so the client can authenticate with Data Grid. Configure client intelligence, if required. Hot Rod clients running on OpenShift can use any client intelligence because they can access internal IP addresses for Data Grid pods. The default intelligence, HASH_DISTRIBUTION_AWARE , is recommended because it allows clients to route requests to primary owners, which improves performance. Programmatic configuration import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.client.hotrod.configuration.SaslQop; import org.infinispan.client.hotrod.impl.ConfigurationProperties; ... ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host("USDSERVICE_HOSTNAME") .port(ConfigurationProperties.DEFAULT_HOTROD_PORT) .security().authentication() .username("username") .password("changeme") .realm("default") .saslQop(SaslQop.AUTH) .saslMechanism("SCRAM-SHA-512"); Hot Rod client properties Additional resources Hot Rod Java Client Guide 6.3.1. Obtaining IP addresses for all Data Grid pods You can retrieve a list of all IP addresses for running Data Grid pods. Important Connecting Hot Rod clients running on OpenShift is the recommended approach as it ensures the initial connection to one of the available pods. Procedure Obtain all the IP addresses for a running Data Grid pods in the following ways: Using the OpenShift API: Access USD{APISERVER}/api/v1/namespaces/<chart-namespace>/endpoints/<helm-release-name> to retrieve the endpoints OpenShift resource associated with the <helm-release-name> service. Using the OpenShift DNS service: Query the DNS service for the name <helm-release-name>-ping to obtain IPs for all the nodes in a cluster. Additional resources Accessing the Kubernetes API from a Pod DNS for Services and Pods 6.4. Connecting Hot Rod clients running outside OpenShift Access remote caches with Hot Rod clients running externally to the OpenShift cluster where you deploy your Data Grid cluster. Prerequisites Expose your Data Grid cluster on the network. Retrieve network service details. Procedure Specify the internal network service detail for your Data Grid cluster in the client configuration. In the following configuration examples, USDSERVICE_HOSTNAME:USDPORT denotes the hostname and port that allows access to your Data Grid cluster. Specify your credentials so the client can authenticate with Data Grid. Configure clients to use BASIC intelligence. Programmatic configuration import org.infinispan.client.hotrod.configuration.ClientIntelligence; import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.client.hotrod.configuration.SaslQop; ... ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host("USDSERVICE_HOSTNAME") .port("USDPORT") .security().authentication() .username("username") .password("changeme") .realm("default") .saslQop(SaslQop.AUTH) .saslMechanism("SCRAM-SHA-512"); builder.clientIntelligence(ClientIntelligence.BASIC); Hot Rod client properties Additional resources Hot Rod Java Client Guide 6.5. Accessing the REST API Data Grid provides a RESTful interface that you can interact with using HTTP clients. Prerequisites Expose your Data Grid cluster on the network. Retrieve network service details. Procedure Access the REST API with any HTTP client at USDSERVICE_HOSTNAME:USDPORT/rest/v2 . Replace USDSERVICE_HOSTNAME:USDPORT with the hostname and port where Data Grid is available on the network. Additional resources Data Grid REST API

Commands:
{native_cli} -c http://cluster-name-myroute.hostname.net/
import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.client.hotrod.configuration.SaslQop; import org.infinispan.client.hotrod.impl.ConfigurationProperties; ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host("USDSERVICE_HOSTNAME") .port(ConfigurationProperties.DEFAULT_HOTROD_PORT) .security().authentication() .username("username") .password("changeme") .realm("default") .saslQop(SaslQop.AUTH) .saslMechanism("SCRAM-SHA-512");
Connection infinispan.client.hotrod.server_list=USDSERVICE_HOSTNAME:USDPORT Authentication infinispan.client.hotrod.use_auth=true infinispan.client.hotrod.auth_username=developer infinispan.client.hotrod.auth_password=USDPASSWORD infinispan.client.hotrod.auth_server_name=USDCLUSTER_NAME infinispan.client.hotrod.sasl_properties.javax.security.sasl.qop=auth infinispan.client.hotrod.sasl_mechanism=SCRAM-SHA-512
import org.infinispan.client.hotrod.configuration.ClientIntelligence; import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import org.infinispan.client.hotrod.configuration.SaslQop; ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer() .host("USDSERVICE_HOSTNAME") .port("USDPORT") .security().authentication() .username("username") .password("changeme") .realm("default") .saslQop(SaslQop.AUTH) .saslMechanism("SCRAM-SHA-512"); builder.clientIntelligence(ClientIntelligence.BASIC);
Connection infinispan.client.hotrod.server_list=USDSERVICE_HOSTNAME:USDPORT Client intelligence infinispan.client.hotrod.client_intelligence=BASIC Authentication infinispan.client.hotrod.use_auth=true infinispan.client.hotrod.auth_username=developer infinispan.client.hotrod.auth_password=USDPASSWORD infinispan.client.hotrod.auth_server_name=USDCLUSTER_NAME infinispan.client.hotrod.sasl_properties.javax.security.sasl.qop=auth infinispan.client.hotrod.sasl_mechanism=SCRAM-SHA-512