keepalive實驗配置

主的配置:

! Configuration File for keepalived

global_defs {
   notification_email {
     [email protected]
   }
   notification_email_from [email protected]
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id zeus01
}

vrrp_instance VI_1 {
    state MASTER
    interface eth1
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.1.2
    }
}

virtual_server 192.168.1.2 80 {
    delay_loop 6
    lb_algo rr
    lb_kind NAT
    nat_mask 255.255.255.0
    persistence_timeout 50
    protocol TCP

    real_server 192.168.1.3 80 {
        weight 1
    notify_up /root/upeth1
    notify_down /root/downeth1
        HTTP_GET {
            url {
              path /web
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }
   
      TCP_CHECK {
    connect_port 80
    bindto 192.168.1.3
    connect_timeout 4`
    }
   }
    real_server 192.168.1.1 80 {
        weight 1
      TCP_CHECK {
        connect_port 80
        bindto 192.168.1.3
        connect_timeout 4`
    }
   }
}
 

從的配置:

! Configuration File for keepalived

global_defs {
   notification_email {
    [email protected]
   }
   notification_email_from [email protected]
   smtp_server 127.0.0.1
   smtp_connect_timeout 30
   router_id zeus02
}

vrrp_instance VI_1 {   
    state BACKUP
    interface eth1
    virtual_router_id 51
    priority 50
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.1.2
    }
}

virtual_server 192.168.1.2 80 {
    delay_loop 6
    lb_algo rr
    lb_kind NAT
    nat_mask 255.255.255.0
    persistence_timeout 50
    protocol TCP

    real_server 192.168.1.1 80 {
        weight 1
        notify_up /root/upeth1
        notify_down /root/downeth1
        HTTP_GET {
            url {
              path /web
            }
            connect_timeout 3
            nb_get_retry 3
            delay_before_retry 3
        }

      TCP_CHECK {
        connect_port 80
        bindto 192.168.1.1
        connect_timeout 4`
    }
    real_server 192.168.1.3 80 {
        weight 1
      TCP_CHECK {
        connect_port 80
        bindto 192.168.1.1
        connect_timeout 4`
    }
   }
}
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章