Sentinel

Instructions for setting up Redis sentinel

Architecture

Redis Sentinel is a tool that provides automatic failover and monitoring for Redis nodes. It works by running separate processes that communicate with each other and with Redis nodes to detect failures, elect a new master node, and configure the other nodes to replicate from the new master. Sentinel can also perform additional tasks such as sending notifications and managing configuration changes. Redis Sentinel is a flexible and robust solution for implementing high availability in Redis.

Helm Installation

In redis sentinel mode, we deploy redis as a single StatefulSet pod that means ease of setup but no complexity, no high availability, and no resilience.

Installation can be easily done via helm command:

$ helm install redis-sentinel ot-helm/redis-sentinel \
  --set redissentinel.clusterSize=3  --namespace ot-operators \
  --set redisSentinelConfig.redisReplicationName="redis-replication"
...
NAME: redis-sentinel
LAST DEPLOYED: Tue Mar 21 23:11:57 2023
NAMESPACE: ot-operators
STATUS: deployed
REVISION: 1
TEST SUITE: None

Verify the sentinel redis setup by kubectl command line.

$ kubectl get pods -n ot-operators
...
NAME                  READY   STATUS    RESTARTS   AGE
redis-sentinel-0      1/1     Running   0          3m40s
redis-sentinel-1      1/1     Running   0          2m55s
redis-sentinel-2      1/1     Running   0          2m10s

YAML Installation

Examples folder has different types of manifests for different scenarios and features. There are these YAML examples present in this directory:

A basic sample manifest for sentinel redis:

---
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisSentinel
metadata:
  name: redis-sentinel
spec:
  clusterSize: 3
  securityContext:
    runAsUser: 1000
    fsGroup: 1000
  redisSentinelConfig: 
    redisReplicationName : redis-replication
  kubernetesConfig:
    image: quay.io/opstree/redis-sentinel:v7.0.12 
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 101m
        memory: 128Mi
      limits:
        cpu: 101m
        memory: 128Mi

The yaml manifest can easily get applied by using kubectl.

$ kubectl apply -f sentinel.yaml

Last modified September 23, 2023: bump image version (#643) (87fa654)