redis哨兵-5
阿新 • • 發佈:2018-05-06
hash 一個 AC 時間值 protect ip 地址 .html file slowlog
#地址: https://www.cnblogs.com/PatrickLiu/p/8444546.html #常用架構 redis1主1從+3哨兵 實現redis高可用 #redis主從 ###############################主###################################### 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 00 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 slave-read-only yes ################################從########################################## 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 #主的連接 slaveof 172.16.0.22 6379 #####################################redis哨兵配置################################################ 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(哨兵)進程去監視一個名為 mymaster 的主服務器,這個主服務器的 IP 地址為 172.16.0.23 , 端口號為 6379,而將這個主服務器判斷為失效至少需要 1 個 Sentinel(哨兵)進程的同意 #註意: #1.如果2個哨兵,有1個哨兵掛了,那麽主從是不會切換的,狀態都會在odwon(客觀下線狀態),所以要哨兵高可用,至少要3個哨兵 #2.如果只有1個哨兵 最後面的1是無所謂的。狀態會是sdown(主觀下線狀態)。 sentinel monitor mymaster 172.16.0.23 6379 1 #(哨兵)進程判斷服務器已經掉線所需的毫秒數 sentinel down-after-milliseconds mymaster 3000 #在執行故障轉移時,最多可以有多少個從服務器同時對新的主服務器進行同步,這個數字越小,完成故障轉移所需的時間就越長。(一般設置為1) sentinel parallel-syncs mymaster 1 #實現主從切換,完成故障轉移的所需要的最大時間值。若Sentinel(哨兵)進程在該配置值內未能完成故障轉移的操作(即故障時master/slave自動切換),則認為本次故障轉移操作失敗 sentinel failover-timeout mymaster 60000 ###############哨兵啟動 /opt/redis/bin/redis-server /opt/redis/16379.conf --sentinel
redis哨兵-5