zoukankan      html  css  js  c++  java
  • keepalived模式+DNS负载均衡

    如何激活并检查IPVS内核模块
    (1)加载ip_vs模块:modrpobe ip_vs
    (2)显示当前加载的模块并过滤:lsmod | grep ip_vs
    (3)查看IPVS版本:cat /proc/net/ip_vs

    1.1LVS master调度器配置

    源码安装ipvsadm

    yum -y install  ipvsadm

    源码安装keepalived

    yum -y install keepalived

    keealived配置

    vim /etc/keepalived/keepalived.conf

    ! Configuration File for keepalived

    global_defs {
    notification_email {
    acassen@firewall.loc
    }
    notification_email_from Alexandre.Cassen@firewall.loc
    smtp_server 127.0.0.1
    smtp_connect_timeout 30
    router_id LVS_DEVEL_2
    }

    vrrp_instance VI_1 {
    state MASTER    #模式
    interface em1      #端口
    virtual_router_id 51    #虚拟路由id
    priority 100     #优先级信息,值越大优先级越高
    advert_int 1       #VRRP通告时间间隔
    authentication {    #认证机制
    auth_type PASS
    auth_pass 1111
    }
    virtual_ipaddress {
    10.191.190.70
    }
    }
    virtual_server 10.191.190.70 53 {
    delay_loop 6        #轮流时间间隔                      
    lb_algo rr          #调度算法
    lb_kind DR         #工作模式
    nat_mask 255.255.254.0
    persistence_timeout 30     #会话保持时间
    protocol UDP        #协议

    real_server 10.191.189.63 53 {
    weight 1          #权重
    TCP_CHECK {       #使用的协议
    connect_timeout 20     #连接超时时间
    connect_port 53      #连接端口
    nb_get_retry 3       #重连次数
    }
    }
    real_server 10.191.189.64 53 {
    weight 1
    TCP_CHECK {
    connect_timeout 20
    connect_port 53
    nb_get_retry 3
    }
    }
    }

    1.2策略文件服务器配置
    DNS服务器1配置和DNS服务器2配置

    配置回环虚拟网卡文件:vim /etc/sysconfig/network-scripts/ifcfg-lo:0
    DEVICE=lo:0
    BOOTPROTO=static
    IPADDR=10.253.67.219
    NETMASK=255.255.255.255
    GATEWAY=10.253.67.129
    ONBOOT=yes

    1.3系统ARP参数的配置
    在此文件未尾增加以下4行:
    vim /etc/sysctl.conf
    ### Arp config for lvs-VIP
    net.ipv4.conf.em1.arp_ignore = 1
    net.ipv4.conf.em1.arp_announce = 2
    net.ipv4.conf.all.arp_ignore = 1
    net.ipv4.conf.all.arp_announce = 2
    因网络中多个设备设置了VIP地址,为防止IP地址冲突,需要通过sysctl.conf文件修改系统内核ARP相关参数

    实际测试过程中,如果虚拟IP和提供服务的dns服务器不在同一个网段,dns服务器无法收到客户端发出的请求。 

  • 相关阅读:
    cocos2d3.8.1 使用prebuild提升发布android速度
    AS3条件编译
    Box2d FilterData
    旋转关节(Revolute Joint)
    线关节(Line Joint)
    平移关节(Prismatic Joint)
    滑轮关节(b2PulleyJoint)
    PAT Basic 1043 输出PATest (20 分)
    PAT Basic 1042 字符统计 (20 分)
    PAT Basic 1039 到底买不买 (20 分)
  • 原文地址:https://www.cnblogs.com/ipanel/p/11758025.html
Copyright © 2011-2022 走看看