2.2. Data Grid 服务器配置值
借助 Data Grid Server 配置值,您可以自定义 Cache Manager 并修改在 OpenShift 容器集中运行的服务器实例。
Data Grid 服务器配置
deploy: infinispan: cacheContainer: # [USER] Add cache, template, and counter configuration. name: default # [USER] Specify `security: null` to disable security authorization. security: authorization: {} transport: cluster: ${infinispan.cluster.name:cluster} node-name: ${infinispan.node.name:} stack: kubernetes server: endpoints: # [USER] Hot Rod and REST endpoints. - securityRealm: default socketBinding: default # [METRICS] Metrics endpoint for cluster monitoring capabilities. - connectors: rest: restConnector: authentication: mechanisms: BASIC securityRealm: metrics socketBinding: metrics interfaces: - inetAddress: value: ${infinispan.bind.address:127.0.0.1} name: public security: credentialStores: - clearTextCredential: clearText: secret name: credentials path: credentials.pfx securityRealms: # [USER] Security realm for the Hot Rod and REST endpoints. - name: default # [USER] Comment or remove this properties realm to disable authentication. propertiesRealm: groupProperties: path: groups.properties groupsAttribute: Roles userProperties: path: users.properties # [METRICS] Security realm for the metrics endpoint. - name: metrics propertiesRealm: groupProperties: path: metrics-groups.properties relativeTo: infinispan.server.config.path groupsAttribute: Roles userProperties: path: metrics-users.properties plainText: true relativeTo: infinispan.server.config.path socketBindings: defaultInterface: public portOffset: ${infinispan.socket.binding.port-offset:0} socketBinding: # [USER] Socket binding for the Hot Rod and REST endpoints. - name: default port: 11222 # [METRICS] Socket binding for the metrics endpoint. - name: metrics port: 11223
deploy:
infinispan:
cacheContainer:
# [USER] Add cache, template, and counter configuration.
name: default
# [USER] Specify `security: null` to disable security authorization.
security:
authorization: {}
transport:
cluster: ${infinispan.cluster.name:cluster}
node-name: ${infinispan.node.name:}
stack: kubernetes
server:
endpoints:
# [USER] Hot Rod and REST endpoints.
- securityRealm: default
socketBinding: default
# [METRICS] Metrics endpoint for cluster monitoring capabilities.
- connectors:
rest:
restConnector:
authentication:
mechanisms: BASIC
securityRealm: metrics
socketBinding: metrics
interfaces:
- inetAddress:
value: ${infinispan.bind.address:127.0.0.1}
name: public
security:
credentialStores:
- clearTextCredential:
clearText: secret
name: credentials
path: credentials.pfx
securityRealms:
# [USER] Security realm for the Hot Rod and REST endpoints.
- name: default
# [USER] Comment or remove this properties realm to disable authentication.
propertiesRealm:
groupProperties:
path: groups.properties
groupsAttribute: Roles
userProperties:
path: users.properties
# [METRICS] Security realm for the metrics endpoint.
- name: metrics
propertiesRealm:
groupProperties:
path: metrics-groups.properties
relativeTo: infinispan.server.config.path
groupsAttribute: Roles
userProperties:
path: metrics-users.properties
plainText: true
relativeTo: infinispan.server.config.path
socketBindings:
defaultInterface: public
portOffset: ${infinispan.socket.binding.port-offset:0}
socketBinding:
# [USER] Socket binding for the Hot Rod and REST endpoints.
- name: default
port: 11222
# [METRICS] Socket binding for the metrics endpoint.
- name: metrics
port: 11223
Data Grid 缓存配置
deploy: infinispan: cacheContainer: distributedCache: name: "mycache" mode: "SYNC" owners: "2" segments: "256" capacityFactor: "1.0" statistics: "true" encoding: mediaType: "application/x-protostream" expiration: lifespan: "5000" maxIdle: "1000" memory: maxCount: "1000000" whenFull: "REMOVE" partitionHandling: whenSplit: "ALLOW_READ_WRITES" mergePolicy: "PREFERRED_NON_NULL" #Provide additional Cache Manager configuration. server: #Provide configuration for server instances.
deploy:
infinispan:
cacheContainer:
distributedCache:
name: "mycache"
mode: "SYNC"
owners: "2"
segments: "256"
capacityFactor: "1.0"
statistics: "true"
encoding:
mediaType: "application/x-protostream"
expiration:
lifespan: "5000"
maxIdle: "1000"
memory:
maxCount: "1000000"
whenFull: "REMOVE"
partitionHandling:
whenSplit: "ALLOW_READ_WRITES"
mergePolicy: "PREFERRED_NON_NULL"
#Provide additional Cache Manager configuration.
server:
#Provide configuration for server instances.
缓存模板
deploy: infinispan: cacheContainer: distributedCacheConfiguration: name: "my-dist-template" mode: "SYNC" statistics: "true" encoding: mediaType: "application/x-protostream" expiration: lifespan: "5000" maxIdle: "1000" memory: maxCount: "1000000" whenFull: "REMOVE" #Provide additional Cache Manager configuration. server: #Provide configuration for server instances.
deploy:
infinispan:
cacheContainer:
distributedCacheConfiguration:
name: "my-dist-template"
mode: "SYNC"
statistics: "true"
encoding:
mediaType: "application/x-protostream"
expiration:
lifespan: "5000"
maxIdle: "1000"
memory:
maxCount: "1000000"
whenFull: "REMOVE"
#Provide additional Cache Manager configuration.
server:
#Provide configuration for server instances.
集群传输
deploy: infinispan: cacheContainer: transport: #Specifies the name of a default JGroups stack. stack: kubernetes #Provide additional Cache Manager configuration. server: #Provide configuration for server instances.
deploy:
infinispan:
cacheContainer:
transport:
#Specifies the name of a default JGroups stack.
stack: kubernetes
#Provide additional Cache Manager configuration.
server:
#Provide configuration for server instances.