k8s_redis_sentinel_2
Redis-Sentinel on Kubernetes Setup ②
Setup (create Pods)
1. Apply YAML files in order
1) Create Config
2) Create Service
3) Create StatefulSet
Three Redis Pods and three Sentinel Pods are running, so Redis-Sentinel is in place.
2. Inspect Redis-Sentinel
1) Check roles (master/replica): redis-role.sh
Script that runs Redis ROLE to check master/replica roles
Run (inspect) result: edited for readability.
2) Inspect Redis monitored by Sentinel: sentinel-info.sh
Script that runs Sentinel 'INFO SENTINEL'
Run (inspect) result: edited for readability.
The master Sentinel monitors is 'redis-0', there are 2 replicas (slaves=2), and 3 Sentinels in total (sentinels=3).
3. 🖧 Redis-Sentinel Pod diagram
4. 💽 Load data
1) Load data
If you take Redis-0 down (delete) for a failover test, Kubernetes recreates redis-0 within about 2 seconds. down-after-milliseconds is 3 seconds, so the downtime of Redis-0 is not detected. So we load about 3 million keys so a restarted Redis takes more than 5 seconds to come back (data load takes about 5 seconds).
2) Verify loaded data
① Key count: 2,955,803 ➡ redis-benchmark generates keys randomly, so duplicates mean we fall a bit short of 3 million.
② AOF file size: aof.1.incr.aof 412M
③ Pod memory: Redis 617MB. Sentinel holds no data, so its size does not grow.
➡ Pods are up and data is loaded. Next: failover test.
| << K8s Redis-Sentinel Prep ① | K8s Redis-Sentinel Test ③ >> |
|---|
