Este conteúdo não está disponível no idioma selecionado.
Chapter 15. Reference
15.1. Probes Copiar o linkLink copiado para a área de transferência!
Data Grid for OpenShift provides a liveness probe and a readiness probe to perform container health checks.
- Liveness probe
The liveness probe is located in the container at
/opt/datagrid/bin/livenessProbe.sh.The liveness probe tests server status and restarts pods if the following events occur:
- Data Grid for OpenShift boots with errors.
- Custom deployment configurations do not successfully deploy.
- One or more caches fail to instantiate, which usually occurs if the cache configuration is not valid.
- Readiness probe
The readiness probe is located in the container at
/opt/datagrid/bin/readinessProbe.sh.The readiness probe determines if the pod is ready to receive requests and checks Data Grid cache level
MBeansto ensure the following:- All cache instances are initialized.
- All cache instances have joined the cluster, if using distributed cache mode.
- Initial state transfer is complete. If state transfer is in progress, the pod is not marked as ready.
- All cache instances in the Cache manager are running.
To configure custom deployments to use the liveness probe and readiness probe, run the following commands:
15.2. Ports Copiar o linkLink copiado para a área de transferência!
Data Grid for OpenShift uses the following ports:
| Port Number | Protocol | Use |
|---|---|---|
| 8080 | TCP | HTTP Access |
| 8443 | TCP | HTTPS Access |
| 8888 | TCP | JGroups Ping |
| 11222 | TCP | Hot Rod Access |
Data Grid deployment configuration templates also use the following ports:
| Port Number | Protocol | Use |
|---|---|---|
| 11211 | TCP | Memcached Access |
| 11333 | TCP | External Hot Rod Access |
| 8778 | TCP | Remote JMX Access |
If you set the HOTROD_SERVICE_NAME environment variable with the deployment configuration templates, the Hot Rod external connector returns ${service_name}:11333 for the endpoint.
15.3. Administration Console Copiar o linkLink copiado para a área de transferência!
The Data Grid Administration Console is not supported on Red Hat OpenShift.
To monitor events and get statistics for Data Grid for OpenShift clusters, you should use Prometheus. See Setting Up Monitoring.
You can also use the Management CLI to troubleshoot Data Grid for OpenShift pods. See Launching the Command Line Interface.
15.4. Environment Variables Copiar o linkLink copiado para a área de transferência!
15.4.1. Monitoring and Logging Copiar o linkLink copiado para a área de transferência!
AB_PROMETHEUS_ENABLEAllows you to collect JMX metrics to monitor and analyze Data Grid. The default value is
false. Set the value totrueto enable monitoring with the default Prometheus agent.The Prometheus Operator must be installed and running. You must also Set Up Monitoring.
AB_PROMETHEUS_JMX_EXPORTER_PORT-
Defines the port on which Data Grid publishes JMX metrics. The default is
9779. LOGGING_CATEGORIESAdjusts the categories and levels for which Data Grid captures log messages, for example:
LOGGING_CATEGORIES=org.infinipan.core=WARN,org.infinispan.config=DEBUG
$ LOGGING_CATEGORIES=org.infinipan.core=WARN,org.infinispan.config=DEBUGCopy to Clipboard Copied! Toggle word wrap Toggle overflow Log categories correspond to Java package names and use standard log levels:
TRACE,DEBUG,INFO,WARN,ERROR, andFATAL.ImportantIf you specify
LOGGING_CATEGORIES, Data Grid does not set the following default loggers. Instead, Data Grid uses the default level ofINFOfor all packages that you do not explicitly specify withLOGGING_CATEGORIES.Expand Table 15.1. Default Loggers Category Level com.arjunaWARNsun.rmiWARNorg.jboss.as.configDEBUG
15.4.2. Containers Copiar o linkLink copiado para a área de transferência!
USERNAMECreates a user in the security realm who is authorized to access data.
NoteBy default, the Hot Rod endpoint uses the
ApplicationRealmsecurity realm and the REST endpoint uses thejdg-openshiftsecurity realm.PASSWORD- Specifies the password for the user.
DATAGRID_SPLITDetermines if the data directory for each node should be split in a mesh. The value is
trueorfalse(default).If you set the value to
true, you must also configure a persistent volume mounted on/opt/datagrid/standalone/partitioned_data.JAVA_OPTS_APPENDAppends options to the
JAVA_OPTSenvironment variable on startup.For example,
JAVA_OPTS_APPEND=-Dfoo=barOPENSHIFT_KUBE_PING_LABELSSpecifies the clustering labels selector.
For example,
OPENSHIFT_KUBE_PING_LABELS=application=eap-appOPENSHIFT_KUBE_PING_NAMESPACE- Specifies the clustering project namespace.
TRANSPORT_LOCK_TIMEOUTSets the time to wait to acquire a distributed lock. The default value is
240000.Data Grid uses a distributed lock to maintain a coherent transaction log during state transfer or rehashing, which means that only one cache can perform state transfer or rehashing at a time. This constraint is in place because more than one cache could be involved in a transaction.
15.4.3. Caches Copiar o linkLink copiado para a área de transferência!
Creating and configuring caches with cache-service and datagrid-service
Do not use environment variables to create and configure caches with cache-service or datagrid-service.
These environment variables are intended for use with the deployment configuration templates only and are deprecated.
You should remote create caches with cache-service and datagrid-service dynamically through the Hot Rod endpoint. For more information, see Remotely Creating Caches.
CACHE_NAMESDefines cache instances in your configuration.
If you are using the Data Grid deployment configuration templates and you do not define any cache instances, the launch script adds a default distributed cache in
SYNCmode.TipGive each cache instance in your configuration a unique name. Use underscore characters (_) and descriptive labels to help you distinguish between cache instances. This ensures that you do not have conflicts when applying cache-specific configuration.
For example,
CACHE_NAMES=addressbook,addressbook_indexedCACHE_CONTAINER_STARTConfigures how the cache container starts. Specify one of the following:
-
LAZYStarts the cache container when requested by a service or deployment. This is the default. -
EAGERStarts the cache container when the server starts.
-
CACHE_CONTAINER_STATISTICS-
Configures the cache container to collect statistics. The value is
true(default) orfalse. You can set the value tofalseto improve performance. DEFAULT_CACHE- Sets the default cache for the cache container.
15.4.3.1. Cache Container Security Configuration Copiar o linkLink copiado para a área de transferência!
CONTAINER_SECURITY_CUSTOM_ROLE_MAPPER_CLASSSpecifies the class of the custom principal to role mapper.
For example,
CONTAINER_SECURITY_CUSTOM_ROLE_MAPPER_CLASS=com.acme.CustomRoleMapperCONTAINER_SECURITY_ROLE_MAPPERSets a role mapper for this cache container with the following values:
-
identity-role-mapperUses the Principal name as the role name. This is the default role mapper if you do not specify one and use theCONTAINER_SECURITY_ROLESenvironment variable to define role names. -
common-name-role-mapperUses the Common Name (CN) as the role name if the Principal name is a Distinguished Name (DN). For example, the DNcn=managers,ou=people,dc=example,dc=comis mapped to themanagerrole name. -
cluster-role-mapperUses theClusterRegistryto store Principal name to role mappings. -
custom-role-mapperTakes the fully-qualified class name of an implementation of theorg.infinispan.security.impl.PrincipalRoleMapperinterface.
-
CONTAINER_SECURITY_ROLESDefines role names and assigns permissions to them.
For example,
CONTAINER_SECURITY_ROLES=admin=ALL,reader=READ,writer=WRITE
15.4.3.2. Named Cache Configuration Copiar o linkLink copiado para a área de transferência!
You specify the cache name as a prefix for the environment variable in capital letters (all caps) otherwise the configuration does not take effect.
For example, you create two separate cache instances: MyCache and MYCACHE. You then set MyCache_CACHE_TYPE=replicated to configure the MyCache instance. This configuration does not take effect. However, if you set MYCACHE_CACHE_TYPE=replicated the configuration takes effect for both the MyCache and MYCACHE instances.
${CACHE_NAME}_CACHE_TYPE-
Determines whether this cache should be distributed or replicated. You can specify either
distributed(default) orreplicated. ${CACHE_NAME}_CACHE_STARTConfigures how the cache starts. Specify one of the following:
-
LAZYStarts the cache when requested by a service or deployment. This is the default. -
EAGERStarts the cache when the server starts.
-
${CACHE_NAME}_CACHE_BATCHING-
Enables invocation batching for this cache. The value is
trueorfalse(default). ${CACHE_NAME}_CACHE_STATISTICS-
Configures the cache to collect statistics. The value is
true(default) orfalse. You can set the value tofalseto improve performance. ${CACHE_NAME}_CACHE_MODESets the clustered cache mode. Specify one of the following:
-
ASYNCfor asynchronous operations. -
SYNCfor synchronous operations.
-
${CACHE_NAME}_CACHE_QUEUE_SIZE-
Sets the threshold at which the replication queue is flushed when the cache is in
ASYNCmode. The default value is0(flushing is disabled). ${CACHE_NAME}_CACHE_QUEUE_FLUSH_INTERVAL-
Specifies the wakeup time, in milliseconds, for the thread that flushes the replication queue in
ASYNCmode. The default value is10. ${CACHE_NAME}_CACHE_REMOTE_TIMEOUT-
Specifies the timeout, in milliseconds, to wait for acknowledgement when making remote calls in
SYNCmode. If the timeout is reached, the remote call is aborted and an exception is thrown. The default value is17500. ${CACHE_NAME}_CACHE_OWNERS-
Specifies the number of cluster-wide replicas for each cache entry. The default value is
2. ${CACHE_NAME}_CACHE_SEGMENTS-
Specifies the number of hash space segments per cluster. The recommended value is
10 * cluster size. The default value is80. ${CACHE_NAME}_CACHE_L1_LIFESPAN-
Specifies the maximum lifespan, in milliseconds, of an entry placed in the L1 cache. The default value is
0(L1 is disabled). ${CACHE_NAME}_CACHE_MEMORY_EVICTION_TYPEDefines the maximum limit for entries in the cache. You can set the following values:
-
COUNTMeasures the number of entries in the cache. When the count exceeds the maximum, Data Grid evicts unused entries. -
MEMORYMeasures the amount of memory that all entries in the cache take up. When the total amount of memory exceeds the maximum, Data Grid evicts unused entries.
-
${CACHE_NAME}_CACHE_MEMORY_STORAGE_TYPEDefines how Data Grid stores entries in the cache. You can set the following values:
Expand Storage Type Description Eviction Type Policy objectStores entries as objects in the Java heap. This is the default storage type.
COUNTTinyLFU
binaryStores entries as
bytes[]in the Java heap.COUNTorMEMORYTinyLFU
off-heapStores entries as
bytes[]in native memory outside the Java.COUNTorMEMORYLRU
${CACHE_NAME}_CACHE_MEMORY_EVICTION_SIZEConfigures the size of the cache before eviction starts. Set the value to a number greater than zero.
-
For
COUNT, the size is the maximum number of entries the cache can hold before eviction starts. For
MEMORY, the size is the maximum number of bytes the cache can take from memory before eviction starts. For example, a value of10000000000is 10 GB.Try different cache sizes to determine the optimal setting. A cache size that is too large can cause Data Grid to run out of memory. At the same time, a cache size that is too small wastes available memory.
NoteIf you configure a JDBC store, passivation is automatically enabled when you set the eviction size to a value that is greater than zero.
-
For
${CACHE_NAME}_CACHE_MEMORY_EVICTION_STRATEGYControls how Data Grid performs eviction. You can set the following values:
Expand Strategy Description NONEData Grid does not evict entries. This is the default setting unless you configure eviction.
REMOVEData Grid removes entries from memory so that the cache does not exceed the configured size. This is the default setting when you configure eviction.
MANUALData Grid does not perform eviction. Eviction takes place manually by invoking the
evict()method from theCacheAPI.EXCEPTIONData Grid does not write new entries to the cache if doing so would exceed the configured size. Instead of writing new entries to the cache, Data Grid throws a
ContainerFullException.${CACHE_NAME}_CACHE_MEMORY_OFF_HEAP_ADDRESS_COUNTSpecifies the number of pointers that are available in the hash map to prevent collisions when using
OFFHEAPstorage. Preventing collisions in the hash map improves performance.Set the value to a number that is greater than the number of cache entries. By default
address-countis 2^20, or 1048576. The parameter is always rounded up to a power of 2.
${CACHE_NAME}_CACHE_EXPIRATION_LIFESPAN-
Specifies the maximum lifespan, in milliseconds, of a cache entry, after which the entry is expired cluster-wide. The default value is
-1(entries never expire). ${CACHE_NAME}_CACHE_EXPIRATION_MAX_IDLE-
Specifies the maximum idle time, in milliseconds, that cache entries are maintained in the cache. If the idle time is exceeded, then the entry is expired cluster-wide. The default value is
-1(expiration is disabled). ${CACHE_NAME}_CACHE_EXPIRATION_INTERVAL-
Specifies the interval, in milliseconds, between runs to purge expired entries from memory and any cache stores. The default value is
5000. Set-1to disable expiration. ${CACHE_NAME}_JDBC_STORE_TYPESets the type of JDBC store to configure. You can set the following values:
-
string -
binary
-
${CACHE_NAME}_JDBC_STORE_DATASOURCEDefines the jndiname of the datasource.
For example,
MYCACHE_JDBC_STORE_DATASOURCE=java:jboss/datasources/ExampleDS${CACHE_NAME}_KEYED_TABLE_PREFIX-
Defines the prefix prepended to the cache name used when composing the name of the cache entry table. The defaule value is
ispn_entry. ${CACHE_NAME}_CACHE_INDEXSets the indexing mode of the cache. You can set the following values:
-
NONEThis is the default. -
LOCAL -
ALL
-
${CACHE_NAME}_INDEXING_PROPERTIESSpecifies a comma-separated list of properties to pass to the indexing system.
For example,
MYCACHE_INDEXING_PROPERTIES=default.directory_provider=ram${CACHE_NAME}_CACHE_SECURITY_AUTHORIZATION_ENABLED-
Enables authorization checks for this cache. The value is
trueorfalse(default). ${CACHE_NAME}_CACHE_SECURITY_AUTHORIZATION_ROLESSets the roles required to access this cache.
For example,
MYCACHE_CACHE_SECURITY_AUTHORIZATION_ROLES=admin, reader, writer
${CACHE_NAME}_CACHE_PARTITION_HANDLING_WHEN_SPLITConfigures the strategy for handling partitions between nodes in a cluster when network events isolate nodes from each other. Partitions function as independent clusters until Data Grid merges cache entries to re-form a single cluster. You can set the following values:
Expand Partition Handling Strategy Description ALLOW_READ_WRITESNodes from any partition can read or write cache entries. This is the default value.
DENY_READ_WRITESNodes enter degraded mode if:
* One or more hash space segments in the partition have no owners. The
ownersare the number of cluster-wide replicas for cache entries.* The partition has less than half the nodes from the most recent stable cluster topology.
In degraded mode, only nodes in the same partition can read or write cache entries. All owners, or copies, for a cache entry must exist on the same partition, otherwise the read or write operation fails with an
AvailabilityException.ALLOW_READSNodes enter degraded mode similarly to the
DENY_READ_WRITESstrategy. Nodes from any partition can read cache entries.In degraded mode, only nodes in the same partition can write cache entries. All owners, or copies, for a cache entry must exist on the same partition, otherwise the write operation fails with an
AvailabilityException.${CACHE_NAME}_CACHE_PARTITION_MERGE_POLICYConfigures how Data Grid resolves conflicts between cache entries when merging partitions. You can set the following values:
Expand Merge Policy Description NONEDo not resolve conflicts when merging partitions. This is the default value.
PREFERRED_ALWAYSAlways use the
preferredEntry. ThepreferredEntryis the primary replica of a cache entry that resides in the partition that contains the most nodes. If the number of nodes is equal between partitions, thepreferredEntryis the cache entry that resides in the partition with the highest topology ID, which means that topology is more recent.PREFERRED_NON_NULLUse the
preferredEntryif it has a value (non-null). If thepreferredEntrydoes not have a value, use the first entry defined inotherEntries.REMOVE_ALLRemove entries (key and value) from the cache if conflicts exist.
${CACHE_NAME}_STATE_TRANSFER_TIMEOUTSets the amount of time, in milliseconds, to wait for other cache instances in the cluster to transfer state to the cache. If other cache instances do not transfer state before the timeout occurs, the application throws an exception and aborts startup. The default value is
240000(4 minutes).You must use a custom template to set this environment variable. It does not take effect if you set the state transfer timeout in the default Data Grid for OpenShift templates.
15.4.4. Security Domain Copiar o linkLink copiado para a área de transferência!
SECDOMAIN_NAME-
Defines additional security domains. For example:
SECDOMAIN_NAME=myDomain SECDOMAIN_PASSWORD_STACKING-
Enables the password staking module and sets the
useFirstPassoption. The value istrueorfalse(default). SECDOMAIN_LOGIN_MODULE-
Specifies a login module to use. The default value is
UsersRoles. SECDOMAIN_USERS_PROPERTIES-
Specifies the properties file that contains user definitions. The default value is
users.properties. SECDOMAIN_ROLES_PROPERTIES-
Specifies the properties file that contains role definitions. The default value is
roles.properties.
15.4.5. Endpoints Copiar o linkLink copiado para a área de transferência!
Clients can access Data Grid via REST, Hot Rod, and Memcached endpoints that you define in the cache configuration.
Clients that run in the same project as Data Grid for OpenShift can access the cache via Hot Rod and receive a full cluster view. These clients can also use consistent hashing capabilities.
However, when clients run in a different project to Data Grid for OpenShift, they need to access the Data Grid cluster using an OpenShift service that exposes the Hot Rod endpoint externally. Depending on your network configuration, clients might not have access to some pods and must use BASIC client intelligence. In these cases, clients might require extra network hops to access data, which can increase network latency.
External access to clients running in OpenShift requires routes with passthrough encryption termination. Clients must also use BASIC client intelligence and the fully qualified domain name as a TLS/SNI host name. Alternatively, you can expose the Data Grid cluster behind a Load Balancer service that is externally available.
Configure endpoints with the following environment variables:
INFINISPAN_CONNECTORS-
Defines a comma-separated list of connectors to configure. Defaults to
hotrod,memcached,rest. If authorization or authentication is enabled on the cache then you should removememcachedbecause this protocol is inherently insecure. MEMCACHED_CACHE-
Sets the cache name for the Memcached connector. Defaults to
memcachedif you do not specify a cache name with theCACHE_NAMESenvironment variable. HOTROD_SERVICE_NAMEDefines the name of the OpenShift service for the external Hot Rod connector.
The external Hot Rod connector is available with deployment configuration templates only if you define this environment variable.
cache-serviceanddatagrid-servicedo not use the external Hot Rod connector.For example, if you set
HOTROD_SERVICE_NAME=DATAGRID_APP_HOTRODthe Hot Rod external connector returnsDATAGRID_APP_HOTROD:11333.REST_STORE_AS_STRINGSpecifies if Data Grid saves entries as Java strings when written to the cache via the REST API. The value is
trueorfalse(default).Set the value to
trueif you are upgrading the image from a previous version and plan to read persisted cache entries.NoteData Grid version 7.1 and earlier: When you write entries to the cache through the REST endpoint, Data Grid stores them as Java strings.
Data Grid version 7.2 and later: Data Grid stores cache entries as
bytes[]to enable data interoperability between clients and protocols.If you upgrade Data Grid for OpenShift images to version 7.2 or later, Data Grid returns null values when you attempt to read cache entries that are persisted to a data store. To resolve the null values, set
REST_STORE_AS_STRING=true.