3.3. Data Grid サービスノードの作成
クロスサイトのレプリケーションなどの Data Grid 機能とカスタムキャッシュ定義を使用するには、Data Grid サービスノードのクラスターを作成します。
手順
InfinispanCR のspec.service.typeの値としてDataGridを指定します。apiVersion: infinispan.org/v1 kind: Infinispan metadata: name: example-infinispan spec: replicas: 2 service: type: DataGridapiVersion: infinispan.org/v1 kind: Infinispan metadata: name: example-infinispan spec: replicas: 2 service: type: DataGridCopy to Clipboard Copied! Toggle word wrap Toggle overflow 注記ノードの作成後に
spec.service.typeフィールドを変更することはできません。サービスタイプを変更するには、既存のノードを削除してから新規のノードを作成する必要があります。- 他の Data Grid サービスリソースを使用してノードを設定します。
-
InfinispanCR を適用して、クラスターを作成します。
3.3.1. Data Grid サービスリソース リンクのコピーリンクがクリップボードにコピーされました!
リンクのコピーリンクがクリップボードにコピーされました!
apiVersion: infinispan.org/v1
kind: Infinispan
metadata:
# Names the cluster.
name: example-infinispan
spec:
# Specifies the number of nodes in the cluster.
replicas: 6
service:
# Configures the service type as Data Grid.
type: DataGrid
# Configures storage resources.
container:
storage: 2Gi
storageClassName: my-storage-class
# Configures cross-site replication.
sites:
local:
name: azure
expose:
type: LoadBalancer
locations:
- name: azure
url: openshift://api.azure.host:6443
secretName: azure-token
- name: aws
url: openshift://api.aws.host:6443
secretName: aws-token
# Configures authentication and encryption.
security:
# Defines a secret with custom credentials.
endpointSecretName: endpoint-identities
# Adds a custom TLS certificate to encrypt client connections.
endpointEncryption:
type: Secret
certSecretName: tls-secret
# Sets container resources.
container:
extraJvmOpts: "-XX:NativeMemoryTracking=summary"
cpu: "1000m"
memory: 1Gi
# Configures logging levels.
logging:
categories:
org.infinispan: debug
org.jgroups: debug
org.jgroups.protocols.TCP: error
org.jgroups.protocols.relay.RELAY2: fatal
# Configures how the cluster is exposed on the network.
expose:
type: LoadBalancer
# Configures affinity and anti-affinity strategies.
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app: infinispan-pod
clusterName: example-infinispan
infinispan_cr: example-infinispan
topologyKey: "kubernetes.io/hostname"
apiVersion: infinispan.org/v1
kind: Infinispan
metadata:
# Names the cluster.
name: example-infinispan
spec:
# Specifies the number of nodes in the cluster.
replicas: 6
service:
# Configures the service type as Data Grid.
type: DataGrid
# Configures storage resources.
container:
storage: 2Gi
storageClassName: my-storage-class
# Configures cross-site replication.
sites:
local:
name: azure
expose:
type: LoadBalancer
locations:
- name: azure
url: openshift://api.azure.host:6443
secretName: azure-token
- name: aws
url: openshift://api.aws.host:6443
secretName: aws-token
# Configures authentication and encryption.
security:
# Defines a secret with custom credentials.
endpointSecretName: endpoint-identities
# Adds a custom TLS certificate to encrypt client connections.
endpointEncryption:
type: Secret
certSecretName: tls-secret
# Sets container resources.
container:
extraJvmOpts: "-XX:NativeMemoryTracking=summary"
cpu: "1000m"
memory: 1Gi
# Configures logging levels.
logging:
categories:
org.infinispan: debug
org.jgroups: debug
org.jgroups.protocols.TCP: error
org.jgroups.protocols.relay.RELAY2: fatal
# Configures how the cluster is exposed on the network.
expose:
type: LoadBalancer
# Configures affinity and anti-affinity strategies.
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app: infinispan-pod
clusterName: example-infinispan
infinispan_cr: example-infinispan
topologyKey: "kubernetes.io/hostname"