首页 > 其他 > 详细

LVS+Keepalived

时间:2016-04-08 07:49:42      阅读:191      评论:0      收藏:0      [点我收藏+]

ip规划:

2个虚拟IP为:192.168.2.18  192.168.2.30 keepalived 本身的DIP:192.168.2.20 192.168.2.30

        

# yum install keepalived

# cp /etc/keepalived/keepalived.conf keepalived.conf.bak

! Configuration File for keepalived


global_defs {

   notification_email {

     acassen@firewall.loc

     failover@firewall.loc

     sysadmin@firewall.loc

   }

   notification_email_from Alexandre.Cassen@firewall.loc

   smtp_server 192.168.200.1

   smtp_connect_timeout 30

   router_id LVS_DEVEL

}


vrrp_instance VI_1 {

    state MASTER

    interface eth0

    virtual_router_id 51

    priority 100

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

        192.168.2.18 brd 192.168.2.18 dev eth0 label eth0:0

    }

}


vrrp_instance VI_2 {

    state BAKCUP

    interface eth0

    virtual_router_id 61

    priority 99

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 2222

    }

    virtual_ipaddress {

        192.168.2.19 brd 192.168.2.19 dev eth0 label eth0:0

    }

}


real_server 192.168.2.18 80 {

    delay_loop 6

    lb_algo rr

    lb_kind DR

    nat_mask 255.255.255.0

 #   persistence_timeout 50

    protocol TCP


    real_server 192.168.2.11 80 {

        weight 1

        HTTP_GET {

            url {

              path /

              status_code 200

            }

            connect_timeout 3

            nb_get_retry 3

            delay_before_retry 3

        }

    }

 real_server 192.168.2.10 80 {

        weight 1

        HTTP_GET {

            url {

              path /index.html

              status_code 200

            }

            connect_timeout 3

            nb_get_retry 3

            delay_before_retry 3

        }

    }

}



real_server 192.168.2.19 80 {

    delay_loop 6

    lb_algo rr

    lb_kind DR

    nat_mask 255.255.255.0

 #   persistence_timeout 50

    protocol TCP


    real_server 192.168.2.11 80 {

        weight 1

        HTTP_GET {

            url {

              path /

              status_code 200

            }

            connect_timeout 3

            nb_get_retry 3

            delay_before_retry 3

        }

    }

 real_server 192.168.2.10 80 {

        weight 1

        HTTP_GET {

            url {

              path /index.html

              status_code 200

            }

            connect_timeout 3

            nb_get_retry 3

            delay_before_retry 3

        }

    }

}


LVS+Keepalived

原文:http://wskfnso.blog.51cto.com/4025557/1761568

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!