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

Chapter 5. Configuring Data Grid clusters


Apply custom Data Grid configuration to clusters that Data Grid Operator manages.

5.1. Applying custom configuration to Data Grid clusters

Add Data Grid configuration to a ConfigMap and make it available to Data Grid Operator. Data Grid Operator can then apply the custom configuration to your Data Grid cluster.

Important

Data Grid Operator applies default configuration on top of your custom configuration to ensure it can continue to manage your Data Grid clusters.

Be careful when applying custom configuration outside the cache-container element or field. You can apply custom configuration to underlying Data Grid Server mechanisms such as endpoints, security realms, and cluster transport. Changing this configuration can result in error and result in service downtime for your Data Grid deployment.

Tip

Use the Data Grid Helm chart to deploy clusters of fully configurable Data Grid Server instances on OpenShift.

Prerequisites

  • Have valid Data Grid configuration in XML, YAML, or JSON format.

Procedure

  1. Add Data Grid configuration to a infinispan-config.[xml|yaml|json] key in the data field of your ConfigMap.

    XML

    apiVersion: v1
    kind: ConfigMap
    metadata:
       name: cluster-config
       namespace: rhdg-namespace
    data:
       infinispan-config.xml: >
         <infinispan>
           <!-- Custom configuration goes here. -->
         </infinispan>

    YAML

    apiVersion: v1
    kind: ConfigMap
    metadata:
       name: cluster-config
       namespace: rhdg-namespace
    data:
       infinispan-config.yaml: >
         infinispan:
           # Custom configuration goes here.

    JSON

    apiVersion: v1
    kind: ConfigMap
    metadata:
       name: cluster-config
       namespace: rhdg-namespace
    data:
       infinispan-config.json: >
         {
           "infinispan": {
           }
         }

  2. Create the ConfigMap from your YAML file.

    oc apply -f cluster-config.yaml
  3. Specify the name of the ConfigMap with the spec.configMapName field in your Infinispan CR and then apply the changes.

    spec:
      configMapName: "cluster-config"

Next steps

If your cluster is already running Data Grid Operator restarts it to apply the configuration. Each time you modify the Data Grid configuration in the ConfigMap, Data Grid Operator detects the updates and restarts the cluster to apply the changes.

Additional resources

5.2. Custom Data Grid configuration

You can add Data Grid configuration to a ConfigMap in XML, YAML, or JSON format.

5.2.1. Cache template

XML

<infinispan>
  <cache-container>
    <distributed-cache-configuration name="base-template">
      <expiration lifespan="5000"/>
    </distributed-cache-configuration>
    <distributed-cache-configuration name="extended-template"
                                     configuration="base-template">
      <encoding media-type="application/x-protostream"/>
      <expiration lifespan="10000"
                  max-idle="1000"/>
    </distributed-cache-configuration>
  </cache-container>
</infinispan>

YAML

infinispan:
  cacheContainer:
    caches:
      base-template:
        distributedCacheConfiguration:
          expiration:
            lifespan: "5000"
      extended-template:
        distributedCacheConfiguration:
          configuration: "base-template"
          encoding:
            mediaType: "application/x-protostream"
          expiration:
            lifespan: "10000"
            maxIdle: "1000"

JSON

{
  "infinispan" : {
    "cache-container" : {
      "caches" : {
        "base-template" : {
          "distributed-cache-configuration" : {
            "expiration" : {
              "lifespan" : "5000"
            }
          }
        },
        "extended-template" : {
          "distributed-cache-configuration" : {
            "configuration" : "base-template",
            "encoding": {
              "media-type": "application/x-protostream"
              },
            "expiration" : {
              "lifespan" : "10000",
              "max-idle" : "1000"
            }
          }
        }
      }
    }
  }
}

5.2.2. Logging configuration

You can also include Apache Log4j configuration in XML format as part of your ConfigMap.

Note

Use the spec.logging.categories field in your Infinispan CR to adjust logging levels for Data Grid clusters. Add Apache Log4j configuration only if you require advanced file-based logging capabilities.

apiVersion: v1
kind: ConfigMap
metadata:
   name: logging-config
   namespace: rhdg-namespace
data:
   infinispan-config.xml: >
     <infinispan>
       <!-- Add custom Data Grid configuration if required. -->
       <!-- You can provide either Data Grid configuration, logging configuration, or both. -->
     </infinispan>

   log4j.xml: >
     <?xml version="1.0" encoding="UTF-8"?>
     <Configuration name="ServerConfig" monitorInterval="60" shutdownHook="disable">
         <Appenders>
             <!-- Colored output on the console -->
             <Console name="STDOUT">
                 <PatternLayout pattern="%d{HH:mm:ss,SSS} %-5p (%t) [%c] %m%throwable%n"/>
             </Console>
         </Appenders>

         <Loggers>
             <Root level="INFO">
                 <AppenderRef ref="STDOUT" level="TRACE"/>
             </Root>
             <Logger name="org.infinispan" level="TRACE"/>
         </Loggers>
     </Configuration>

Additional resources

5.3. Securing custom Data Grid configuration

Securely define and store custom Data Grid Server configuration. To protect sensitive text strings such as passwords, add the entries in a credential store rather than directly in the Data Grid Server configuration.

Prerequisites

  • Have a valid Data Grid configuration in XML, YAML, or JSON format.

Procedure

  1. Create a CredentialStore Secret file.
  2. Use the data field to specify the credentials and its aliases.

    user-secret.yaml

    apiVersion: v1
    kind: Secret
    metadata:
      name: user-secret
    type: Opaque
    data:
      postgres_cred: sensitive-value
      mysql_cred: sensitive-value2

  3. Apply your Secret file.

    oc apply -f user-secret.yaml
  4. Open the Infinispan CR for editing.
  5. In the spec.security.credentialStoreSecretName field, specify the name of the credential store secret.

    Infinispan CR

    spec:
      security:
        credentialStoreSecretName: user-secret

  6. Apply the changes.
  7. Open your Data Grid Server configuration for editing.
  8. Add a credential-reference to your configuration.

    1. Specify the credentials as the name of the store.
    2. Specify the alias attribute as one of the keys defined in your credential secret.

      Data Grid.xml

      <credential-store>
          <credential-reference store="credentials"  alias="postgres_cred"/>
      </credential-store>

Additional resources

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

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

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

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

Red Hat 소개

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

© 2024 Red Hat, Inc.