이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 2. Getting started with Infinispan CR


After you install Data Grid Operator, learn how to create Data Grid clusters on OpenShift.

2.1. Infinispan custom resource (CR)

Data Grid Operator adds a new Custom Resource (CR) of type Infinispan that lets you handle Data Grid clusters as complex units on OpenShift.

Data Grid Operator watches for Infinispan Custom Resources (CR) that you use to instantiate and configure Data Grid clusters and manage OpenShift resources, such as StatefulSets and Services. In this way, the Infinispan CR is your primary interface to Data Grid on OpenShift.

The minimal Infinispan CR is as follows:

apiVersion: infinispan.org/v1
kind: Infinispan
metadata:
  name: example-infinispan
spec:
  replicas: 2
Copy to Clipboard Toggle word wrap
Expand
FieldDescription

apiVersion

Declares the version of the Infinispan API.

kind

Declares the Infinispan CR.

metadata.name

Specifies a name for your Data Grid cluster.

spec.replicas

Specifies the number of pods in your Data Grid cluster.

2.2. Creating Data Grid clusters

Use Data Grid Operator to create clusters of two or more Data Grid pods.

Prerequisites

  • Install Data Grid Operator.
  • Have an oc client.

Procedure

  1. Specify the number of Data Grid pods in the cluster with spec.replicas in your Infinispan CR.

    For example, create a cr_minimal.yaml file as follows:

    $ cat > cr_minimal.yaml<<EOF
    apiVersion: infinispan.org/v1
    kind: Infinispan
    metadata:
      name: example-infinispan
    spec:
      replicas: 2
    EOF
    Copy to Clipboard Toggle word wrap
  2. Apply your Infinispan CR.

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

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

Next Steps

Try changing the value of replicas: and watching Data Grid Operator scale the cluster up or down.

2.3. Verifying Data Grid clusters

Check that Data Grid pods have successfully formed clusters.

Procedure

  • Retrieve the Infinispan CR for Data Grid Operator.

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

    The response indicates that Data Grid pods have received clustered views, as in the following example:

    conditions:
      - message: 'View: [example-infinispan-0, example-infinispan-1]'
        status: "True"
        type: wellFormed
    Copy to Clipboard Toggle word wrap
Tip

Do the following for automated scripts:

$ oc wait --for condition=wellFormed --timeout=240s infinispan/example-infinispan
Copy to Clipboard Toggle word wrap

Alternatively, you can retrieve cluster view from logs as follows:

$ oc logs example-infinispan-0 | grep ISPN000094

INFO  [org.infinispan.CLUSTER] (MSC service thread 1-2) \
ISPN000094: Received new cluster view for channel infinispan: \
[example-infinispan-0|0] (1) [example-infinispan-0]

INFO  [org.infinispan.CLUSTER] (jgroups-3,example-infinispan-0) \
ISPN000094: Received new cluster view for channel infinispan: \
[example-infinispan-0|1] (2) [example-infinispan-0, example-infinispan-1]
Copy to Clipboard Toggle word wrap

2.4. Stopping and starting Data Grid clusters

Stop and start Data Grid pods in a graceful, ordered fashion to correctly preserve cluster state.

Clusters of Data Grid service pods must restart with the same number of pods that existed before shutdown. This allows Data Grid to restore the distribution of data across the cluster. After Data Grid Operator fully restarts the cluster you can safely add and remove pods.

Procedure

  1. Change the spec.replicas field to 0 to stop the Data Grid cluster.

    spec:
      replicas: 0
    Copy to Clipboard Toggle word wrap
  2. Ensure you have the correct number of pods before you restart the cluster.

    $ oc get infinispan example-infinispan -o=jsonpath='{.status.replicasWantedAtRestart}'
    Copy to Clipboard Toggle word wrap
  3. Change the spec.replicas field to the same number of pods to restart the Data Grid cluster.

    spec:
      replicas: 6
    Copy to Clipboard Toggle word wrap
맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat