Hero Image

Redis Sentinel (High Availability) on NetBSD 10

Redis Sentinel (High Availability) on NetBSD 10

Sentinel monitors a Redis primary and promotes a replica on failure.

Architecture

  • Primary: 192.168.1.10:6379
  • Replica 1: 192.168.1.11:6379
  • Replica 2: 192.168.1.12:6379
  • 3 Sentinel instances (ports 26379)

Step 1 – Configure Primary

redis.conf:

bind 0.0.0.0
requirepass RedisPass!

Step 2 – Configure Replicas

redis.conf on each replica:

bind 0.0.0.0
requirepass RedisPass!
replicaof 192.168.1.10 6379
masterauth RedisPass!

Step 3 – Configure Sentinels (all 3 nodes)

/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

Step 4 – Start Sentinels

redis-sentinel /etc/redis/sentinel.conf &
# or:
redis-server /etc/redis/sentinel.conf --sentinel &

Step 5 – Test failover

redis-cli -p 26379 sentinel masters
redis-cli -p 26379 sentinel slaves myprimary

Simulate primary failure:

redis-cli -h 192.168.1.10 -p 6379 -a RedisPass! DEBUG sleep 30

Sentinel should promote a replica within ~10 seconds.