美文网首页
keepalived mysql 主主高可用

keepalived mysql 主主高可用

作者: xun2019 | 来源:发表于2018-06-22 13:18 被阅读0次

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),来查看。

相关文章

网友评论

      本文标题:keepalived mysql 主主高可用

      本文链接:https://www.haomeiwen.com/subject/efqmsftx.html