基于Keepalived双主模型的高可用LVS(2)

real_server 192.168.19.29 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

real_server 192.168.19.34 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
}

virtual_server 192.168.19.151 80 {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP

real_server 192.168.19.29 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

real_server 192.168.19.34 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
}

keep2上:

vim /etc/keepalived/keepalived.conf
----------------------------------------------

vrrp_instance VI_1 {
    state BACKUP
    interface eth0
    virtual_router_id 31
    priority 99
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass abcd
    }
    virtual_ipaddress {
        192.168.19.150
    }
}

vrrp_instance VI_2 {
    state MASTER
    interface eth0
    virtual_router_id 41
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass abcd
    }
    virtual_ipaddress {
        192.168.19.151
    }
}

virtual_server 192.168.19.150 80 {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP

real_server 192.168.19.29 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

real_server 192.168.19.34 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
}

virtual_server 192.168.19.151 80 {
    delay_loop 6
    lb_algo rr
    lb_kind DR
    protocol TCP

real_server 192.168.19.29 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

real_server 192.168.19.34 {
        weight 1
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
}

3.两台机器启动keepalived

service keepalived start
ipvsadm -L -n              //用LVS工具查看keepalived运行
ip addr show              //查看VIP

基于Keepalived双主模型的高可用LVS

    两台机器上LVS规则都已经生效,且2个VIP分别运行在2个节点:

      keep1上:

基于Keepalived双主模型的高可用LVS

      keep2上:

基于Keepalived双主模型的高可用LVS

    分别打开测试页面进行测试:

基于Keepalived双主模型的高可用LVS

基于Keepalived双主模型的高可用LVS

基于Keepalived双主模型的高可用LVS

基于Keepalived双主模型的高可用LVS

    停掉任何一个节点,资源都会自动转移:

基于Keepalived双主模型的高可用LVS

  至此,演示完毕,谢谢!

CentOS 6.3下Haproxy+Keepalived+Apache配置笔记

Haproxy + KeepAlived 实现WEB群集 on CentOS 6

Keepalived+Haproxy配置高可用负载均衡

Haproxy+Keepalived构建高可用负载均衡

CentOS 7 上配置LVS + Keepalived + ipvsadm

Keepalived高可用集群搭建

LVS/DR + Keepalived搭建负载均衡集群

LVS+Keepalived实现四层负载及高可用 

LVS+Keepalived高可用负载均衡集群架构实验 

Heartbeat+LVS构建高可用负载均衡集群 

搭建LVS负载均衡测试环境 

一个针对LVS的压力测试报告

Keepalived构建高可用LVS集群 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/3565c984d3b3d33da8acd47f97db1216.html