如何识别哪台keepalived机器在漂移时的优先级顺序?
是根据/etc/keepalived/keepalived.conf配置文件中的“priority”参数来决定的,数值越大的优先级越高,如下图
router_id #命名,比如填写:hd205_MySQL_1/2
nopreempt #非抢占模式,主填从不填
interface #实际网卡名称
priority #表示优先级,数值越大者优先
auth_type #鉴权模式,一般填写PASS
auth_pass #根据实际填写密码
virtual_ipaddress #虚拟的IP地址(VIP),比如192.1.1.103
delay_loop ##每个2秒检查一次real_server状态
notify_down ##检测到服务down后执行的脚本
connect_timeout ##连接超时时间
nb_get_retry ##重连次数
delay_before_retry ##重连间隔时间
connect_port ##健康检查端口
notify_master /path/to/to_master.sh:#表示当切换到master状态时,要执行的脚本
notify_backup /path_to/to_backup.sh:#表示当切换到backup状态时,要执行的脚本
notify_stop /path_to/to_stop.sh:#表示当切换到stop状态时,要执行的脚本
备注:keepalived.conf中不能有任何的注释,否则启动之后也不产生VIP。
OK,解答完毕。
我是昊鼎王五,我为自己带盐,有兴趣的朋友们可以扫码关注公众号,更多惊喜等待着你哦