keepalived mysql 主主高可用

2018-06-22  本文已影响0人  xun2019

yum install -y keepalived

master1配置

编辑配置文件/etc/keepalived.conf

vrrp_instance VI_1 {

    state MASTER

    interface eth0

    virtual_router_id 51    priority 200    advert_int 1    nopreempt

    authentication {

        auth_type PASS

        auth_pass 1234x  

}

virtual_ipaddress {

       192.168.5.66

  }

}

master2配置

vrrp_instance VI_1 {

    state BACKUP

    interface eth0

    virtual_router_id 51

    priority 100

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1234x

    }

    notify_master /etc/keepalived/notify_master_mysql.sh

    virtual_ipaddress {

        192.168.5.66

    }

}

启动命令:

service keepalived start/restart/stop

测试及验证:

执行命令 ip a (注意ifconfig命令无法查看到配置的虚拟IP),来查看。

上一篇下一篇

猜你喜欢

热点阅读