Este conteúdo não está disponível no idioma selecionado.

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 $SERVICE_HOSTNAME:$PORT.

    Replace $SERVICE_HOSTNAME:$PORT 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

  1. Start the Data Grid CLI with the network service as the value for the -c argument, for example:

    $ {native_cli} -c http://cluster-name-myroute.hostname.net/
    Copy to Clipboard Toggle word wrap
  2. Enter your Data Grid credentials when prompted.
  3. Perform CLI operations as required.

    Tip

    Press the tab key or use the --help argument to view available options and help text.

  4. Use the quit command to exit the CLI.

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

  1. Specify the internal network service detail for your Data Grid cluster in the client configuration.

    In the following configuration examples, $SERVICE_HOSTNAME:$PORT denotes the hostname and port that allows access to your Data Grid cluster.

  2. Specify your credentials so the client can authenticate with Data Grid.
  3. 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("$SERVICE_HOSTNAME")
               .port(ConfigurationProperties.DEFAULT_HOTROD_PORT)
             .security().authentication()
               .username("username")
               .password("changeme")
               .realm("default")
               .saslQop(SaslQop.AUTH)
               .saslMechanism("SCRAM-SHA-512");
Copy to Clipboard Toggle word wrap

Hot Rod client properties

# Connection
infinispan.client.hotrod.server_list=$SERVICE_HOSTNAME:$PORT

# Authentication
infinispan.client.hotrod.use_auth=true
infinispan.client.hotrod.auth_username=developer
infinispan.client.hotrod.auth_password=$PASSWORD
infinispan.client.hotrod.auth_server_name=$CLUSTER_NAME
infinispan.client.hotrod.sasl_properties.javax.security.sasl.qop=auth
infinispan.client.hotrod.sasl_mechanism=SCRAM-SHA-512
Copy to Clipboard Toggle word wrap

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 ${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.

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

  1. Specify the internal network service detail for your Data Grid cluster in the client configuration.

    In the following configuration examples, $SERVICE_HOSTNAME:$PORT denotes the hostname and port that allows access to your Data Grid cluster.

  2. Specify your credentials so the client can authenticate with Data Grid.
  3. 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("$SERVICE_HOSTNAME")
               .port("$PORT")
             .security().authentication()
               .username("username")
               .password("changeme")
               .realm("default")
               .saslQop(SaslQop.AUTH)
               .saslMechanism("SCRAM-SHA-512");
      builder.clientIntelligence(ClientIntelligence.BASIC);
Copy to Clipboard Toggle word wrap

Hot Rod client properties

# Connection
infinispan.client.hotrod.server_list=$SERVICE_HOSTNAME:$PORT

# 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=$PASSWORD
infinispan.client.hotrod.auth_server_name=$CLUSTER_NAME
infinispan.client.hotrod.sasl_properties.javax.security.sasl.qop=auth
infinispan.client.hotrod.sasl_mechanism=SCRAM-SHA-512
Copy to Clipboard Toggle word wrap

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 $SERVICE_HOSTNAME:$PORT/rest/v2.

    Replace $SERVICE_HOSTNAME:$PORT with the hostname and port where Data Grid is available on the network.

Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat