#地址:
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
bind 0.0.0.0
timeout
tcp-keepalive
loglevel notice
logfile "/opt/redis/logs/redis_6379.log"
databases
save
save
save
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
auto-aof-rewrite-min-size 64mb
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-entries
list-max-ziplist-value
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
slave-read-only yes ################################从##########################################
daemonize yes
protected-mode no
pidfile "/var/run/redis_6379.pid"
port
bind 0.0.0.0
timeout
tcp-keepalive
loglevel notice
logfile "/opt/redis/logs/redis_6379.log"
databases
save
save
save
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
auto-aof-rewrite-min-size 64mb
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-entries
list-max-ziplist-value
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
#主的连接
slaveof 172.16.0.22 6379 #####################################redis哨兵配置################################################
port
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 , 端口号为 ,而将这个主服务器判断为失效至少需要 个 Sentinel(哨兵)进程的同意
#注意:
#.如果2个哨兵,有1个哨兵挂了,那么主从是不会切换的,状态都会在odwon(客观下线状态),所以要哨兵高可用,至少要3个哨兵
#.如果只有1个哨兵 最后面的1是无所谓的。状态会是sdown(主观下线状态)。
sentinel monitor mymaster 172.16.0.23
#(哨兵)进程判断服务器已经掉线所需的毫秒数
sentinel down-after-milliseconds mymaster
#在执行故障转移时,最多可以有多少个从服务器同时对新的主服务器进行同步,这个数字越小,完成故障转移所需的时间就越长。(一般设置为1)
sentinel parallel-syncs mymaster
#实现主从切换,完成故障转移的所需要的最大时间值。若Sentinel(哨兵)进程在该配置值内未能完成故障转移的操作(即故障时master/slave自动切换),则认为本次故障转移操作失败
sentinel failover-timeout mymaster ###############哨兵启动
/opt/redis/bin/redis-server /opt/redis/.conf --sentinel ###sping boot配置连接哨兵 spring.redis.database=xxx spring.redis.sentinel.master=mymaster

  spring.redis.sentinel.nodes=10.150.0.104:26379,10.150.0.104:26380,10.150.0.105:26379

最新文章

  1. [jquery]jquery正则表达式验证(手机号、身份证号、中文名称)
  2. JS高程3.基本概念(2)
  3. MIT 6.824 : Spring 2015 lab3 训练笔记
  4. SqlSever基础 datediff 计算人的生日是不准确的,示例
  5. discuz论坛X3升级时 文件下载出现问题,请查看您的服务器网络以及data目录是否有写权限
  6. check、continue、exit的区别
  7. thinkpad t530 centos 6.4 有线网卡 设置
  8. IOS开发之语音合成(科大讯飞)详解
  9. 201521123026 《Java程序设计》第5周学习总结
  10. JWT(JSON Web Token) 【转载】
  11. 修改GIT密码
  12. 【K8S】client-go、python-k8sclient开发K8S
  13. A1132. Cut Integer
  14. Sonya and Robots(CodeForces 1004C)
  15. boost::asio::io_context类
  16. 阿里2015校招面试回忆录(成功拿到offer)
  17. python2脚本批量转成python3
  18. 转:Linux实时将所有输出重定向到文件
  19. [题解] CodeM美团点评编程竞赛资格赛题
  20. Ionic2开发环境搭建

热门文章

  1. DELPHI之全局变量和局部变量
  2. IAR MSP430怎么破解?IAR for MSP430安装注册破解激活图文详细教程
  3. 【ABAP系列】SAP ABAP常用函数总结第一篇
  4. PTA 1121 Damn Single
  5. Run Your Tensorflow Deep Learning Models on Google AI
  6. Mac011--DbWrench Database安装
  7. Java8默认方法
  8. jvm(1)性能监控-linux相关命令
  9. [HDU 5293]Tree chain problem(树形dp+树链剖分)
  10. psfaddtable - 添加一个Unicode字符表到控制台字体中