zoukankan      html  css  js  c++  java
  • 三主机配置 keepalived VIP高可用

    三台主机:
    192.168.33.134
    192.168.33.136
    192.168.33.137
     
    实验前:
    关闭selinux 和iptables
     
     
    1). 192.168.33.134 配置
    #yum install keepalived
    #systemctl start keepalived
    #systemctl enable keepalived
     
    #cp vim /etc/keepalived/keepalived.conf{,.bak}
     
    #vim /etc/keepalived/keepalived.conf
    ! Configuration File for keepalived
     
    global_defs {
       notification_email {
          root@centos7.magedu.com
       }
       notification_email_from root@centos7.magedu.com
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id centos7.magedu.com
       vrrp_skip_check_adv_addr
       vrrp_strict
       vrrp_garp_interval 0
       vrrp_gna_interval 0
       vrrp_iptables
    }
     
    vrrp_instance VIP_1 {
        state MASTER
        interface ens33
        virtual_router_id 51
        priority 100
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            192.168.33.200 dev ens33 label ens33:0
        }
     
     
    2). 192.168.33.136 配置
    #yum install keepalived
    #systemctl start keepalived
    #systemctl enable keepalived
     
    #cp vim /etc/keepalived/keepalived.conf{,.bak}
     
    #vim /etc/keepalived/keepalived.conf
    ! Configuration File for keepalived
     
    global_defs {
       notification_email {
          root@centos7.magedu.com
       }
       notification_email_from root@centos7.magedu.com
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id centos7.magedu.com
       vrrp_skip_check_adv_addr
       vrrp_strict
       vrrp_garp_interval 0
       vrrp_gna_interval 0
       vrrp_iptables
    }
     
    vrrp_instance VIP_1 {
        state BACKUP
        interface ens33
        virtual_router_id 51
        priority 50
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            192.168.33.200 dev ens33 label ens33:0
        }
     
     
    3). 192.168.33.137配置
    #yum install keepalived
    #systemctl start keepalived
    #systemctl enable keepalived
     
    #cp vim /etc/keepalived/keepalived.conf{,.bak}
     
    #vim /etc/keepalived/keepalived.conf
    ! Configuration File for keepalived
     
    global_defs {
       notification_email {
          root@centos7.magedu.com
       }
       notification_email_from root@centos7.magedu.com
       smtp_server 127.0.0.1
       smtp_connect_timeout 30
       router_id centos7.magedu.com
       vrrp_skip_check_adv_addr
       vrrp_strict
       vrrp_garp_interval 0
       vrrp_gna_interval 0
       vrrp_iptables
    }
     
    vrrp_instance VIP_1 {
        state BACKUP
        interface ens33
        virtual_router_id 51
        priority 10
        advert_int 1
        authentication {
            auth_type PASS
            auth_pass 1111
        }
        virtual_ipaddress {
            192.168.33.200 dev ens33 label ens33:0
        }
    
    
     
     
     
    默认组播:抓包,看到流量是发往组播
    [root@centos7 ~]#tcpdump -i ens33 -nn host 224.0.0.18
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
    10:35:43.325499 IP 192.168.33.134 > 224.0.0.18: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, length 20
    10:35:44.327673 IP 192.168.33.134 > 224.0.0.18: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, length 20
    10:35:45.329368 IP 192.168.33.134 > 224.0.0.18: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, length 20
    10:35:46.331697 IP 192.168.33.134 > 224.0.0.18: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, leng

     

  • 相关阅读:
    移动端touch与click区别--移动端开发整理笔记(五)
    移动端适配(rem & viewport)--移动端开发整理笔记(四)
    移动端事件(touchstart、touchmove、touchend)--移动端开发整理笔记(三)
    Flex弹性盒模型(新老版本完整)--移动端开发整理笔记(二)
    meta设置与去除默认样式--移动端开发整理笔记(一)
    react native ios 上架
    react16 路由按需加载、路由权限配置
    mpvue 页面预加载,新增preLoad生命周期
    mpvue 星星打分组件
    mpvue 签字组件
  • 原文地址:https://www.cnblogs.com/xiaohanlin/p/11064996.html
Copyright © 2011-2022 走看看