zoukankan      html  css  js  c++  java
  • lamp----7 *并实现负载均衡

    在代理端

    vi /etc/httpd/conf/httpd.conf


    ProxyPass / http://192.168.1.142
    ProxyPassReverse / http://192.168.1.142

    去访问192.168.1.148.。就可以到192.168.1.142

     *******************************************************************************************

    负载均衡实现

    使用三个服务器两个源站。一个代理142,144 为源站,148为代理

    在代理写

    vi /etc/httpd/conf/httpd.conf 

    ProxyRequests off
    ProxyPass / balancer://mycluster/
    ProxyPassReverse / balancer://mycluster/
    <Proxy balancer://mycluster>
    ProxySet lbmethod=byrequests
    BalancerMember http://192.168.1.142 loadfactor=1 smax=5 max=20 ttl=120 retry=300 timeout=15
    BalancerMember http://192.168.1.144 loadfactor=1 smax=5 max=20 ttl=120 retry=300 timeout=15
    </Proxy>

    systemctl restart httpd.service 

    源站写

    systemctl restart httpd.service

    访问148.。。可看到144和142 内容哦

    webbench测试

    wget http://blog.zyan.cc/soft/linux/webbench/webbench-1.5.tar.gz
    tar zxvf webbench-1.5.tar.gz
    cd webbench-1.5
    make && make install

    webbench -c 500 -t 30 http://192.168.1.148

    测试结果!

    Webbench - Simple Web Benchmark 1.5
    Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

    Benchmarking: GET http://127.0.0.1/test.jpg
    500 clients, running 30 sec.

    Speed=3230 pages/min, 11614212 bytes/sec.
    Requests: 1615 susceed, 0 failed.

  • 相关阅读:
    memcache详解
    redis详解
    laravel5表单验证
    MySQL添加字段和修改字段
    delete和truncate区别
    IOC 和DI(转载)
    JPA和SpringData知识梳理
    spring和springmvc配置分离
    springboot 整合 mybatis
    mongodb安装及配置
  • 原文地址:https://www.cnblogs.com/han1094/p/6370925.html
Copyright © 2011-2022 走看看