Linux集群之HA(高可用集群)篇

LVS+Keepalive网络结构:

IP 备注
120.10.10.10 ipvsadm master
120.10.10.11 ipvsadm slave
120.10.10.12 web1
120.10.10.13 web2

1、搭建LVS DR模式,见上一篇文章Linux集群之LB(负载均衡集群)篇
2、高可用搭建
使用Keepalived实现高可用
主副节点Keepalived设置
vi /etc/keepalived/keepalived.conf

! Configuration File for keepalived

global_defs {
   router_id R1
   }

vrrp_instance VI_1 {
    # 副节点 SLAVE
    state MASTER
    interface ens37
    virtual_router_id 66
    # 副节点稍微降低,建议30
    priority 80
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        120.10.10.100
    }
}

virtual_server 120.10.10.100 80 {
    delay_loop 1
    lb_algo rr
    lb_kind DR
    persistence_timeout 50
    protocol TCP

    real_server 120.10.10.12 80 {
        weight 1
        TCP_CHECK{
          connect_port 80
          connect_timeout 3
          nb_get_retry 3
          delay_before_retry 4
        }
    }
    real_server 120.10.10.13 80 {
        weight 1
        TCP_CHECK{
          connect_port 80
          connect_timeout 3
          nb_get_retry 3
          delay_before_retry 4
        }
    }
}
上一篇:Hadoop HDFS-HA


下一篇:Vimperator的有用操作