
HCL Commerce - Redis client configurations
HCL Commerce uses the Redisson client to communicate with the Redis server. Redisson is configured using a YAML configuration file, which is defined in the HCL Commerce Helm chart and stored in a Kubernetes configuration map.
The Redisson YAML configuration needs to be customized to:
- Match the topology of the Redis server (standalone, cluster)
- Specify the Redis server hostnames
- Tune pools and retries
- Configure security options (password, SSL)
Connection options:
- Authentication
-
If the Redis server enables password authentication, the password can be specified in the Yaml configuration file.
Create a Vault key
redisPasswordEncrypt
under the environment type (for exampleqa
orprod
). The password must be encrypted using wcs_encrypt.password: "${ENCRYPTED:REDIS_PASSWORD_ENCRYPT:-}"
Alternatively, the password can be entered in plain text (not secure), or stored encrypted in an environment variable named REDIS_PASSWORD_ENCRYPT.
- TLS
-
The Redis client can be configured to access a Redis service that uses SSL/TLS. For more information, see Redis With TLS.
Time-out and retries configuration:
Redisson includes a number of configurations to handle timeouts and retries. Timeouts can be reduced to allow the remote operation to complete faster, but it could lead to sporadic time-out errors.
connectTimeout: 10000
timeout: 3000
retryAttempts: 3
retryInterval: 1500
Read mode
replicas
(slaves), the readMode configuration specifies if the master
,
slave
, or both servers are used for read (GET)
operations:readMode: SLAVE
The use of replicas for read/ GET operations increases scalability as it frees resources in the master node (one master can have multiple replicas), and allows for better use of resources. See Redis Replicas for details.
Sample configuration files:
- Standalone Redis: singleServerConfig.yaml
- Redis Cluster: clusterServersConfig.yaml
Redis client configuration in HCL Commerce
hclCache:
configMap:
# content for cache_cfg-ext.yaml
cache_cfg_ext: |-
redis:
enabled: true
yamlConfig: "/SETUP/hcl-cache/redis_cfg.yaml" # Please leave this line untouched
# content for redis_cfg.yaml
redis_cfg: |-
singleServerConfig:
idleConnectionTimeout: 10000
connectTimeout: 3000
timeout: 1000
...