Redis Sentinel (HA) on NetBSD 10
Architecture
- Primary 192.168.1.10:6379
- Replica 192.168.1.11:6379, 192.168.1.12:6379
- Sentinels on port 26379 (all 3 nodes)
Primary redis.conf
bind 0.0.0.0
requirepass RedisPass!
Replica redis.conf
bind 0.0.0.0
requirepass RedisPass!
replicaof 192.168.1.10 6379
masterauth RedisPass!
Sentinel config (/etc/redis/sentinel.conf)
port 26379
sentinel monitor myprimary 192.168.1.10 6379 2
sentinel auth-pass myprimary RedisPass!
sentinel down-after-milliseconds myprimary 5000
sentinel failover-timeout myprimary 60000
sentinel parallel-syncs myprimary 1
Start sentinels
redis-sentinel /etc/redis/sentinel.conf &
Test failover
redis-cli -p 26379 sentinel masters
redis-cli -h 192.168.1.10 -p 6379 -a RedisPass! DEBUG sleep 30
# Sentinel promotes a replica within ~10 s