所有栏目 | 云社区 美国云服务器[国内云主机商]
你的位置:首页 > 云社区 » 正文

LVS+keepalived高并发怎么做?

发布时间:2020-04-15 16:14:22

资讯分类:keepalived  lvs  并发  搭建  器上  配置
LVS+keepalived高并发怎么做?

keepalived ,lvs,tomcat 高可用,高并发,高性能  应用架构的搭建 

 

keepalived ,lvs 搭建在同一台服务器上,两个tomcat 分别在一个tomcat上  

 

四台服务器版本 :  centos 6.5 

 

yum install ipvsadm -y 

 

keepalived : etc/keepalived/keepalived.conf

 

! Configuration File for keepalived

 

global_defs {

   notification_email {

     root@localhost

   }

   notification_email_from Alexandre.Cassen@firewall.loc

   smtp_server 192.168.184.178

   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.184.222/24 dev eth0 label eth0:A

    }

}

 

virtual_server 192.168.184.222 80 {

    delay_loop 6

    lb_algo wrr

    lb_kind DR

    nat_mask 255.255.255.0

    persistence_timeout 50

    protocol TCP

 

    real_server 192.168.184.188 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.184.168 80 {

        weight 1

        HTTP_GET {

            url {

              path /

              status_code 200

            }

            connect_timeout 3

            nb_get_retry 3

            delay_before_retry 2

        }

    }

}

 

=================

 

! Configuration File for keepalived

 

global_defs {

   notification_email {

     root@localhost

   }

   notification_email_from Alexandre.Cassen@firewall.loc

   smtp_server 192.168.184.178

   smtp_connect_timeout 30

   router_id LVS_DEVEL

}

 

vrrp_instance VI_1 {

    state BACKUP 

    interface eth0

    virtual_router_id 51

    priority 10

    advert_int 1

    authentication {

        auth_type PASS

        auth_pass 1111

    }

    virtual_ipaddress {

        192.168.184.222/24 dev eth0 label eth0:A

    }

}

 

virtual_server 192.168.184.222 80 {

    delay_loop 6

    lb_algo wrr

    lb_kind DR

    nat_mask 255.255.255.0

    persistence_timeout 50

    protocol TCP

 

    real_server 192.168.184.188 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.184.168 80 {

        weight 1

        HTTP_GET {

            url {

              path /

              status_code 200

            }

            connect_timeout 3

            nb_get_retry 3

            delay_before_retry 2

        }

    }

}

 

   

 

========================

 

  tomcat 服务器上需要配置 在设备上配置lo:A  IP地址 

留言与评论(共有 0 条评论)
   
验证码:
Top