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

Chapter 4. Configuring Clustering


The JBoss Data Grid for OpenShift images can use either the Kubernetes or DNS discovery mechanisms for clustering. These discovery mechanisms enable images to automatically join clusters.

By default, DNS is pre-configured in the JBoss Data Grid for OpenShift image templates. If you want to use Kubernetes as the discovery mechanism, or if you plan to build and deploy a custom image, you must configure cluster discovery.

Note

JBoss Data Grid does not support removing images from an active cluster.

4.1. Configuring the Kubernetes Discovery Mechanism

To configure the Kubernetes discovery mechanism for clustering, do the following:

  1. Set openshift.KUBE_PING as the value for the JGROUPS_PING_PROTOCOL environment variable.

    JGROUPS_PING_PROTOCOL=openshift.KUBE_PING
  2. Specify the OpenShift project name as the value for the OPENSHIFT_KUBE_PING_NAMESPACE environment variable. If you do not set this variable, the server behaves like a single-node cluster.

    OPENSHIFT_KUBE_PING_NAMESPACE=PROJECT_NAME
  3. Specify the label that is set at the service level as the value for the OPENSHIFT_KUBE_PING_LABELS environment variable. If you do not set this variable, pods outside the application but in the same namespace attempt to join.

    OPENSHIFT_KUBE_PING_LABELS=app=APP_NAME
  4. Grant authorization to the service account the pod is running under so that it can access the Kubernetes REST API. You grant this authorization using the OpenShift CLI, as follows:

    Granting authorization for the default service account in the myproject namespace:

    oc policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q)

    Granting authorization for eap-service-account in the myproject namespace:

    oc policy add-role-to-user view system:serviceaccount:$(oc project -q):eap-service-account -n $(oc project -q)
  5. Ensure port 8888 is defined as a ping port on the pod container, as follows:

    ports:
        - containerPort: 8888
          name: ping
          protocol: TCP

4.2. Configuring the DNS Discovery Mechanism

To configure the DNS discovery mechanism for clustering, do the following:

  1. Set openshift.DNS_PING as the value for the JGROUPS_PING_PROTOCOL environment variable.

    JGROUPS_PING_PROTOCOL=openshift.DNS_PING
  2. Specify the name of the ping service for the cluster as the value for the OPENSHIFT_DNS_PING_SERVICE_NAME environment variable.

    OPENSHIFT_DNS_PING_SERVICE_NAME=PING_SERVICE_NAME
  3. Specify the port number where the ping service is exposed as the value for the OPENSHIFT_DNS_PING_SERVICE_PORT environment variable. The default value is 8888.

    OPENSHIFT_DNS_PING_SERVICE_PORT=PING_PORT
  4. Define a ping service that exposes the ping port, as in the following example:

    apiVersion: v1
    kind: Service
    spec:
      clusterIP: None
      ports:
        - name: ping
          port: 8888
          protocol: TCP
          targetPort: 8888
      selector: deploymentConfig=datagrid-app
    metadata:
      annotations:
        description: The JGroups ping port for clustering.
        service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true'
    Important

    You should configure clusterIP: None so that the service is headless. Likewise, the ping port must be named and include the service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' annotation.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.