redis sentinel-5

#address:
https://www.cnblogs.com/PatrickLiu/p/8444546.html


#Common architecture
redis1 master 1 slave + 3 sentinels to achieve redis high availability


#redis master-slave
###############################host################## ####################
daemonize yes
protected-mode no
pidfile "/var/run/redis_6379.pid"
port 6379
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/opt/redis/logs/redis_6379.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/opt/redis/data/6379"
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
slave-read-only yes


################################from################# ##################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
daemonize yes
protected-mode no
pidfile "/var/run/redis_6379.pid"
port 6379
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
logfile "/opt/redis/logs/redis_6379.log"
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
dir "/opt/redis/data/6379"
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
#main connection
slaveof 172.16.0.22 6379



#####################################redis sentinel configuration########## ###############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
port 16379
dir /opt/redis/data/
daemonize yes
protected-mode no
logfile " /opt/redis/logs/redis_16379.log " 
pidfile " /var/run/redis_16379.pid " 
# Sentinel process to monitor a master server named mymaster whose IP address is 172.16 . 0.23 , the port number is 6379 , and at least one Sentinel (sentry) process is required to judge this master server as invalid .
#Notice:
# 1. If there are 2 sentinels and 1 sentinel hangs, then the master-slave will not switch, and the state will be in odwon (objective offline state), so if the sentinel is highly available, at least 3 sentinels are required
# 2 . The last 1 doesn't matter if there is only 1 sentinel. The state will be sdown (subjective offline state).
sentinel monitor mymaster  172.16.0.23 6379 1     
# (Sentinel) The number of milliseconds required by the process to determine that the server has been offline
sentinel down-after-milliseconds mymaster 3000
# When performing a failover, the maximum number of slaves that can be synchronized to the new master at the same time, the lower the number, the longer it will take to complete the failover. (Generally set to 1)
sentinel parallel -syncs mymaster 1 #To 
achieve master-slave switchover, the maximum time value required to complete the failover. If the Sentinel (sentry) process fails to complete the failover operation within the configuration value (that is, the master / slave automatically switches when a failure occurs), the failover operation is considered to have failed.
sentinel failover-timeout mymaster 60000


############## Sentinel start
/opt/redis/bin/redis-server /opt/redis/16379.conf --sentinel

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325331713&siteId=291194637