ApacheLoad Balancing
In general, load balancing is the client's request to the backend of the various real servers, to achieve load balancing purposes. Another way is to use two servers, one as the primary server (master), the other as a hot Standby, request all the primary server, when the primary server, immediately switch to the backup server to improve the high availability.
This module must be available:
Loadmoduleproxy_module modules/mod_proxy.so
Loadmoduleproxy_balancer_module modules/mod_proxy_balancer.so
1. Normal Load:
Proxyrequestsoff
<Proxybalancer://server3.example.com>
Balancermember http://192.168.88.128:80
Balancermember http://192.168.88.129:80
</Proxy>
Proxypass/test balancer://server3.example.com/
# here access to Server3.example.com/test can be accessed, the reason is to add test, is not with the following access/balancer conflict, otherwise access/balancer is also assigned to Realserver above
# The following is the status Web statistics of the access, the production environment is not added as well
<Location/balancer-manager>
SetHandler Balancer-manager
Order Deny,allow
Allow from all
</Location>
2. weight load:
Proxyrequestsoff
<Proxybalancer://server3.example.com>
Balancermember http://192.168.88.128:80loadfactor=8
Balancermember http://192.168.88.129:80loadfactor=1
</Proxy>
3. Other load algorithms:
Proxyrequestsoff
<Proxybalancer://server3.example.com>
Balancermember http://192.168.88.128:80loadfactor=8
Balancermember http://192.168.88.129:80loadfactor=1
</Proxy>
Proxypass/test balancer://server3.example.com/ lbmethod=bytraffic
Lbmethod the possible values are:
Lbmethod=byrequests by Request number equalization (default)
Lbmethod=bytraffic according to the flow balance
Lbmethod=bybusyness in a busy balance (always assigned to the server with the fewest number of active requests)
4. Hot Standby
the implementation of hot backup is simple, just add status=+h property, you can designate a server as a backup server , Access has been in the 192.168.88.128, only it hangs, only to 129.
<Proxybalancer://server3.example.com>
Balancermember http://192.168.88.128:80loadfactor=8
Balancermember http://192.168.88.129:80loadfactor=1 status=+h
</Proxy>
Apache Simple Load