diff --git a/plugins/keepalived/config/keepalived.backup.conf b/plugins/keepalived/config/keepalived.backup.conf deleted file mode 100644 index 124063410..000000000 --- a/plugins/keepalived/config/keepalived.backup.conf +++ /dev/null @@ -1,55 +0,0 @@ -! Configuration File for keepalived - -global_defs { - notification_email { - root@localroot - } - notification_email_from keepalived@localhost - smtp_server 127.0.0.1 - smtp_connect_timeout 30 - router_id LVS_DEVEL - vrrp_skip_check_adv_addr - vrrp_strict - vrrp_garp_interval 0 - vrrp_gna_interval 0 -} - -#检测mysql服务是否在运行。有很多方式,比如进程,用脚本检测等等 -vrrp_script chk_mysql_port { - #这里通过脚本监测 - script "{$PLUGIN_PATH}/scripts/chk_mysql.sh" - #脚本执行间隔,每2s检测一次 - interval 2 - #脚本结果导致的优先级变更,检测失败(脚本返回非0)则优先级 -5 - weight –5 - #检测连续2次失败才算确定是真失败。会用weight减少优先级(1-255之间) - fall 2 - #检测1次成功就算成功。但不修改优先级 - rise 1 -} - -vrrp_instance VI_1 { - #这里所有节点都定义为BACKUP - state BACKUP - #指定虚拟ip的网卡接口 - interface eth0 - #路由器标识,MASTER和BACKUP必须是一致的 - virtual_router_id 51 - #定义优先级,数字越大,优先级越高,在同一个vrrp_instance下,MASTER的优先级必须大于BACKUP的优先级。 - priority 99 - advert_int 1 - #不抢占模式,在优先级高的机器上设置即可,优先级低的机器可不设置 - nopreempt - authentication { - auth_type PASS - auth_pass 1111 - } - virtual_ipaddress { - #虚拟IP - 192.168.10.10 - } - - track_script { - chk_mysql_port - } -} \ No newline at end of file diff --git a/plugins/keepalived/config/keepalived.conf b/plugins/keepalived/config/keepalived.conf index 8a3f2e46f..d9f7181e6 100644 --- a/plugins/keepalived/config/keepalived.conf +++ b/plugins/keepalived/config/keepalived.conf @@ -1,36 +1,20 @@ ! Configuration File for keepalived global_defs { - notification_email { - root@localroot - } - notification_email_from keepalived@localhost - smtp_server 127.0.0.1 - smtp_connect_timeout 30 - router_id LVS_DEVEL - vrrp_skip_check_adv_addr - vrrp_strict - vrrp_garp_interval 0 - vrrp_gna_interval 0 + router_id MYSQL_MHA } -#检测mysql服务是否在运行。有很多方式,比如进程,用脚本检测等等 vrrp_script chk_mysql_port { - #这里通过脚本监测 script "{$PLUGIN_PATH}/scripts/chk_mysql.sh" - #脚本执行间隔,每2s检测一次 interval 2 - #脚本结果导致的优先级变更,检测失败(脚本返回非0)则优先级 -5 - weight –5 - #检测连续2次失败才算确定是真失败。会用weight减少优先级(1-255之间) + weight –5 fall 2 - #检测1次成功就算成功。但不修改优先级 rise 1 } vrrp_instance VI_1 { state MASTER - interface eth0 + interface {$ETH_XX} virtual_router_id 51 priority 100 advert_int 1