search

Home  >  Q&A  >  body text

redis - keepalived主备问题?

目前出现问题如下:
master keepalived配置为:
priority 200
nopreempt

slave keepalived配置为:
priority 190

两个的检查脚本都是:
vrrp_script chk_redis {

script "/usr/local/keepalived/scripts/redis_check.sh"
weight -20
interval 2                                    

}

当master的redis1挂掉之后,master keepalived的priority会一直降,slave的redis2就会变成主redis,等发现并重启redis1之后,master keepalived的priority 已经降为0了,这时候,如果redis2挂掉,因为master keepalived设置为nopreempt,所以不会抢占为master,也就是虚拟ip访问的还是slave 机器,而slave的redis2已经挂掉,整个系统就出问题了。结果就是每次发现redis1挂掉之后,为了防止意外,就只能整个重启redis1、redis2、master keepalived、slave keepalived。
不知道我这样表达有没有乱掉。
有没有办法解决这个问题。
谢谢!

天蓬老师天蓬老师2797 days ago649

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-04-24 09:15:14

    keepalived + redis configures high availability, no need to configure priority; just have the same priority;
    keepalived preempts VIP, and when the redis instance status changes, just execute your script

    reply
    0
  • Cancelreply