此内容没有您所选择的语言版本。

Chapter 2. Spinning Up Data Grid Clusters


You create Data Grid clusters from custom resource definitions.

Prerequisites

Install the Data Grid Operator from the OperatorHub.

2.1. Creating Minimal Data Grid Clusters

Quickly spin up a Data Grid cluster with two nodes and let the Data Grid Operator generate credentials. You can retrieve the credentials from the pods after you create the Data Grid cluster. However, because Data Grid clusters require authentication, you cannot connect to the pods without the credentials.

Procedure

  1. Create a custom resource yaml for the minimal cluster.

    $ cat > cr_minimal.yaml<<EOF
    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: example-rhdg
    spec:
      replicas: 2
    EOF
    Copy to Clipboard Toggle word wrap
    • replicas specifies the number of nodes in the Data Grid cluster.
  2. Apply the custom resource yaml.

    $ oc apply -f cr_minimal.yaml
    Copy to Clipboard Toggle word wrap
  3. Verify that the Data Grid Operator creates the pods.

    $ oc get pods -w
    
    NAME                        READY  STATUS              RESTARTS   AGE
    example-rhdg-1               0/1    ContainerCreating   0          4s
    example-rhdg-2               0/1    ContainerCreating   0          4s
    example-rhdg-3               0/1    ContainerCreating   0          5s
    infinispan-operator-0        1/1    Running             0          3m
    example-rhdg-3               1/1    Running             0          8s
    example-rhdg-2               1/1    Running             0          8s
    example-rhdg-1               1/1    Running             0          8s
    Copy to Clipboard Toggle word wrap

2.2. Creating Data Grid Clusters with Credentials

Create secrets that contain credentials so application users can authenticate to Data Grid nodes. You can then specify the name of the secret in a custom resource yaml and spin up clusters with the Data Grid Operator.

Procedure

  1. Create a secret that contains credentials for the application user.

    1. Add an authentication secret yaml, for example:

      $ cat > connect_secret.yaml<<EOF
      apiVersion: v1
      kind: Secret
      metadata:
        name: connect-secret
      type: Opaque
      stringData:
        username: developer
        password: changeme
      EOF
      Copy to Clipboard Toggle word wrap

      The secret must:

      • Be type: Opaque.
      • Have username and password fields.

        Important

        The preceding authentication secret contains sample values for the username and password fields. You should replace these values with credentials that conform to your organization’s security requirements.

    2. Apply the authentication secret yaml.

      $ oc apply -f connect_secret.yaml
      Copy to Clipboard Toggle word wrap
  2. Create a custom resource yaml for the cluster that includes the name of the secret that contains your credentials.

    $ cat > cr_minimal_with_auth.yaml<<EOF
    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: example-rhdg
    spec:
      replicas: 2
      connector:
        authentication:
          type: Credentials
          secretName: connect-secret
    EOF
    Copy to Clipboard Toggle word wrap
    • replicas specifies the number of nodes in the Data Grid cluster.
    • connector configures how users connect to Data Grid nodes to store and retrieve data.
  3. Apply the custom resource yaml.

    $ oc apply -f cr_minimal_with_auth.yaml
    Copy to Clipboard Toggle word wrap
  4. Verify that the Data Grid Operator creates the pods.

    $ oc get pods -w
    
    NAME                        READY  STATUS              RESTARTS   AGE
    example-rhdg-1               0/1    ContainerCreating   0          4s
    example-rhdg-2               0/1    ContainerCreating   0          4s
    example-rhdg-3               0/1    ContainerCreating   0          5s
    infinispan-operator-0        1/1    Running             0          3m
    example-rhdg-3               1/1    Running             0          8s
    example-rhdg-2               1/1    Running             0          8s
    example-rhdg-1               1/1    Running             0          8s
    Copy to Clipboard Toggle word wrap

2.3. Verifying Data Grid Clusters

Review log messages to verify that the Data Grid Operator has successfully created a Data Grid cluster.

Procedure

  1. Verify that the Data Grid nodes can discover each other, for example:

    $ oc logs example-rhdg-0 | grep DNS_PING
    
    INFO Configuring JGroups discovery protocol to openshift.DNS_PING
    INFO  [org.jgroups.protocols.openshift.DNS_PING] (MSC service thread 1-2) serviceName [my-namespace] set; clustering enabled
    Copy to Clipboard Toggle word wrap
  2. Verify that the nodes have received a clustered view. Do either of the following:

    • Retrieve the cluster view from the pod log files.

      $ oc logs example-rhdg-0 | grep ISPN000094
      
      INFO  [org.infinispan.CLUSTER] (MSC service thread 1-2) \
      ISPN000094: Received new cluster view for channel cluster: \
      [example-rhdg-0|0] (1) [example-rhdg-0]
      
      INFO  [org.infinispan.CLUSTER] (jgroups-3,{example_crd_name-0) \
      ISPN000094: Received new cluster view for channel cluster: \
      [example-rhdg-0|1] (2) [example-rhdg-0, example-rhdg-1]
      Copy to Clipboard Toggle word wrap
    • Retrieve the custom resource type for the Data Grid Operator.

      $ oc get infinispan -o yaml
      Copy to Clipboard Toggle word wrap

      The output of the preceding command contains the following message to indicate that the Data Grid nodes have received a clustered view:

      conditions:
          - message: 'View: [example-rhdg-0, example-rhdg-1]'
            status: "True"
            type: wellFormed
      Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部