首页 Keepalived教程实战案例: 实现双主的LVS-DR模式

实战案例: 实现单主的LVS-DR模式

实战案例:实现双主的,LVS-DR模式利用FWM绑定成一个双主集群服务

运维派隶属马哥教育旗下专业运维社区,是国内成立最早的IT运维技术社区,欢迎关注公众号:yunweipai
领取学习更多免费Linux云计算、Python、Docker、K8s教程关注公众号:马哥linux运维

实战案例2:实现双主的LVS-DR模式
[root@ka1-centos8 ~]#vim /etc/keepalived/keepalived.conf
! Configuration File for keepalived
    global_defs {
        notification_email {
            root@localhost
        }
        notification_email_from keepalived@localhost
        smtp_server 127.0.0.1
        smtp_connect_timeout 30
        router_id ka1.magedu.org                #另一个节点为ka2.magedu.org
        vrrp_mcast_group4 224.0.100.10
    }

vrrp_instance VI_1 {
    state MASTER                                #在另一个结点上为BACKUP
    interface eth0
    virtual_router_id 66
    priority 100                                #在另一个结点上为80
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 123456
    }
    virtual_ipaddress {
        10.0.0.10/24 dev eth0 label eth0:1      #指定VIP
    }
}

vrrp_instance VI_2 {
    state BACKUP                                #在另一个结点上为MASTER
    interface eth0
    virtual_router_id  88
    priority 80                                 #在另一个结点上为100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 123456
    }
    virtual_ipaddress {
        10.0.0.20/24 dev eth0 label eth0:2      #指定VIP2
    }
}
virtual_server 10.0.0.10 80 {  
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP
    sorry_server 127.0.0.1 80
    real_server 10.0.0.7 80 {  #指定RS1地址
        weight 1
        HTTP_GET {
            url {
                path /
                status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

    }
    real_server 10.0.0.17 80 {                  #指定RS2地址
        weight 1
        HTTP_GET {
            url {
                path /
                status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

    }   

}

virtual_server 10.0.0.20 80 {                       #指定VIP2
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP
    sorry_server 127.0.0.1 80
    real_server 10.0.0.27 80 {                      #指定RS3地址
        weight 1
        HTTP_GET {
            url {
                path /
                status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

    }
    real_server 10.0.0.37 80 {                      #指定RS4地址
        weight 1
        HTTP_GET {
            url {
                path /
                status_code 200
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
    }   
}

本文链接:https://www.yunweipai.com/35382.html

实战案例: 实现单主的LVS-DR模式

实战案例:实现双主的,LVS-DR模式利用FWM绑定成一个双主集群服务

网友评论comments

发表回复

您的电子邮箱地址不会被公开。

暂无评论

Copyright © 2012-2022 YUNWEIPAI.COM - 运维派 京ICP备16064699号-6
扫二维码
扫二维码
返回顶部