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

     

  • 相关阅读:
    关于自发电的一些想法
    折腾了一个晚上的业余时间,终于把一块廉价的tftlcd连到了我的树莓派上
    关于飞行器从外太空返回地球时候的减速器的思考与假象
    echart漏斗图背景多出一个方框的问题解决,浪费了两个小时的教训
    linux加密文件系统 fsck 无法修复一例
    天津
    [转]Bitmap图片缩放
    python spark 配置
    screen
    tar 命令
  • 原文地址:https://www.cnblogs.com/xiaohanlin/p/11064996.html
Copyright © 2011-2022 走看看