keepalived高可用双主配置文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了keepalived高可用双主配置文件相关的知识,希望对你有一定的参考价值。


###########################lb01

cat /etc/keepalived/keepalived.conf

! Configuration File for keepalived_lb01


global_defs {

#  notification_email {

#  [email protected]

#  }


   router_id LB01

}


vrrp_script check_lb {  

script "/server/scripts/check_lb.sh"  

interval 2                            

weight 2

}


vrrp_instance VI_1 {

    state BACKUP

    interface eth0

    virtual_router_id 51

    priority 100

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

     10.0.0.3/24 dev eth0 label eth0:1  

    }

    track_script {

    check_lb

    }

}   

vrrp_instance VI_2 {

    state MASTER

    interface eth0

    virtual_router_id 52

    priority 150

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

     10.0.0.4/24 dev eth0 label eth0:2

    }

}

#######################lb02

 cat /etc/keepalived/keepalived.conf

! Configuration File for keepalived_lb01


global_defs {

#  notification_email {

#  [email protected]

#  }


   router_id LB01

}


vrrp_script check_lb {  

script "/server/scripts/check_lb.sh"  

interval 2                            

weight 2

}


vrrp_instance VI_1 {

    state MASTER

    interface eth0

    virtual_router_id 51

    priority 150

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

     10.0.0.3/24 dev eth0 label eth0:1  

    }

    track_script {

    check_lb

    }

}   

vrrp_instance VI_2 {

    state BACKUP

    interface eth0

    virtual_router_id 52

    priority 100

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

     10.0.0.4/24 dev eth0 label eth0:2

    }

}


以上是关于keepalived高可用双主配置文件的主要内容,如果未能解决你的问题,请参考以下文章

keepalived 安装配置(高可用VIP),双主模式

keepalived+mysql双主高可用配置

Mysql5.7.22+Keepalived双主互备高可用集群

KeepAlived双主模式高可用集群

Mysql + Keepalived 实现双主互备高可用详细配置

Nginx+keepalived双主配置(双机双主热备)