Apache Load Balancer
Apache can also achieve load balancing. The load balancing of Apache is mainly mod_proxy_balancer
achieved by implementation. So, what is the configuration method for Apache load Balancing?
In the Apache configuration file, httpd.conf
add
ProxyPass / balancer://proxy/ #注意这里以"/"结尾 <Proxy balancer://proxy> BalancerMember http://192.168.6.37:6888/ BalancerMember http://192.168.6.38:6888/ </Proxy>
It is not necessary to httpd.conf
add it directly in ProxyPass / balancer
. Another way to do this is to add it to httpd.conf
Include conf/httpd-proxy.conf
, and then ProxyPass
write to it httpd-proxy.conf
in.
Here is a detailed description of what this configuration file means:
- Where
ProxyPass
is the Configure Virtual Server command
- /should be class to filter rule, refers to the Web request URL suffix (refer to the URL is said to be a prefix, do not understand). If only the
/redmine
request is load balanced, it needs to be changed /redmine
.
balancer://proxy
Indicates that you want to configure load balancing to proxy
indicate a load balancer name, or to change to another name, for example redmine_cluster
.
Indicates that it will be http://192.168.6.37:6888/
registered to load balancer.
The load balancer shown above is polling load balancing, besides, there are load balancing policies weighted by weight and load balancing policies for weight request response. Where the former allocates the load according to the number of requests, while the latter distributes the load according to the request load. For example: According to the former, if there are 4 requests, 3 times are assigned to machine A, 1 times assigned to Machine B. According to the latter, there are 1000bytes requests, 750bytes is assigned to a, 250bytes is assigned to B. Refer to the following link for details
Reference
Apache Load Balancer