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.

  • 相关阅读:
    哈利波特买书事件
    闹钟类app构想
    梦断代码(7-尾)
    梦断代码(3-6)
    梦断代码(0-2)
    环形二维数组求最大子矩阵
    数组问题
    电梯考察
    四则运算的三张计划表
    团队开发用户需求调研
  • 原文地址:https://www.cnblogs.com/han1094/p/6370925.html
Copyright © 2011-2022 走看看