Standalone Mode
Standalone Mode in Redis.
For the role of the Redis cluster in HEAL and its service/redis/* Consul keys, see Redis Cluster and Consul Keys.
Standalone Mode#
Redis standalone mode is a default configuration, which refers to the instances running on a single node/module. It has all six nodes (master-slave behavior) in one server.

High Availability (HA) Mode#
Redis HA mode has multiple Redis nodes which enable high availability and fault tolerance.
The Redis acts as a master-slave replication in all 3 servers.

The behavior of the 3 servers is as follows:
- The data of the master (N1) from server 1 is stored in the slave (N4) of server 2.
- The data of the master (N3) from server 2 is stored in the slave (N6) of server 3.
- The data of the master (N5) from server 3 are stored in the slave (N2) of server 1.
The above distribution of data is to avoid data loss during a server failure.
During the failure of a server, the redis behaves as below:
When server 1 fails, the slave (N4) from server 2 is automatically promoted to a new master (fault tolerance) since the backup data of the master (N1) is saved in the slave (N4).
But for Redis to function, there should be 3 masters available. Hence, in servers 2 & 3, one of the slaves (N4 or N6) is converted to master, and Redis is functional with the 2 servers.
When server 1 is recovered and is in working condition, both nodes N1 & N2 are converted into slaves. Then the rearranging of the master-slave nodes to their original state is done.
Advantages of HA mode over Standalone mode
- Good load balancing
- Effective data durability
- Scalability
- Fault tolerance
- Enhanced availability
- Data redundancy
Execute the below command inside the Redis container to get the details of the master-slave of all the servers.
redis-cli -c --tls --cert /etc/redis.crt --key /etc/redis.key --cacert /etc/appnomic-rootca.crt
-h <redis-node-IP> -p <redis-node-port> cluster nodes
For example:
redis-cli -c --tls --cert /etc/redis.crt --key /etc/redis.key --cacert /etc/appnomic-rootca.crt
-h 19x.xyz.xy.xyz -p 9002 cluster nodes
After executing the above command, the following output is obtained:

Note:
- In Standalone mode: The Redis microservice reads config data from node 1.
- In HA mode: Redis microservice reads config data from node 2.
Setup of Redis#
Standalone Mode#
Refer to HEAL V2.2.1 Install Config Guide_RHEL 7.x and 8.4 to 8.6: Section 6.1.pdf
High Availability (HA) Mode#
Refer to HEAL V2.2.1 Install Config Guide_RHEL 7.x and 8.4 to 8.6: Section 6.2.pdf
Note: For Redis Authentication, refer next section.
Redis Authentication#
The below section provides the steps to set the Redis authentication.
-
First stop the Redis and Redis microservice by the below command:
nomad stop redis nomad stop redis-micro-service -
Update the below Consul keys:
consul kv put service/redis/password/encrypted <encryted-password> consul kv put service/redis/password <redis-password>To get the encrypted password, execute the below command:
echo -n <password> | base64 -
If a Redis is already installed and if only the authentication is required, then add the below two lines in the Redis Nomad file after the line bind 0.0.0.0 in the template section:
requirepass {{key "service/redis/password"}} masterauth {{key "service/redis/password"}}Note: For reference (redis nomad file): redis.nomad.txt. Add the required and master authentication password in all six sections.
-
Restart Redis.
- Restart the Redis microservice (which is connected to Redis) and check if Redis and the Redis microservice can connect.
Redis-cli Commands#
Number of keys in Redis#
To check the number of keys in Redis, execute the below command:
redis-cli -c --tls --cert /etc/redis.crt --key /etc/redis.key --cacert /etc/appnomic-rootca.crt
-h <redis-node-IP> -p <redis-node-Port> info keyspace
For example:
redis-cli -c --tls --cert /etc/redis.crt --key /etc/redis.key --cacert /etc/appnomic-rootca.crt -h 19x.xyz.xy.xyz -p 9002 info keyspace
List the Keys in Redis#
To fetch the list of keys in Redis, execute the below command:
hgetall /users/key
Status of Keys#
To check the status of the keys in Redis, execute the below command:
keys *users*<userID>*
For example:
keys *users/a1d1784f-f1e6-4a20-8a45-f64b0517d995*
Note: Below two keys below are not recommended to use without authorization.
1. Delete keys: To delete a specific key in redis, execute the below command:
hdel key field <field>
2. Flush all the keys: To delete all the keys in Redis, execute the below command:
redis-cli -c --tls --cert /etc/redis.crt --key /etc/redis.key --cacert /etc/appnomic-rootca.crt
-h <redis-node-IP> -p <redis-node-Port> flushall
For example:
redis-cli -c --tls --cert /etc/redis.crt --key /etc/redis.key --cacert /etc/appnomic-rootca.crt
-h 19x.xyz.xy.xyz -p 9002 flushall
Stitching keys in Redis#
In Redis, stitching keys are created to stitch between the request and response transaction. The stitching keys help Redis to perform effectively and swiftly.
For example:
When the C24 transaction sends a request and response to the data receiver, which sends it to Redis with a unique Time-To-Live (TTL) and stitching ID for each data, Redis analyses both the request and response stitching ID, and if both have the same stitching ID, then Redis stitches both request and response data. The stitched data are sent to the control center.
If the request or response TTL is expired, then the data is stored in OpenSearch in the name of timed-out transaction data.