Home  >  Article  >  Backend Development  >  Detailed explanation of Apache's implementation of Web Server load balancing (regardless of Session version)_PHP tutorial

Detailed explanation of Apache's implementation of Web Server load balancing (regardless of Session version)_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:01:26790browse

At least three servers are required:
Server A: control server
Server B and Server C: actual execution server
Load balancing principle: Distribute requests to access server A to Server B and Server C
Modify the http.conf file of apache on Server A:

First, load the corresponding proxy module and remove the # sign in front of the following modules:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Secondly, add at the end of the file:
ProxyPass /example/ balancer://proxy/

BalancerMember http://serverB /example/
BalancerMember http://serverC/example/

means to distribute all files in the http://serverA/example/ subdirectory of server A to servers B and C for execution, which is equivalent to accessing http://serverB/example/ or http://serverC/example / subdirectory files.

If written as:
ProxyPass / balancer://proxy/

BalancerMember http://serverB/
BalancerMember http ://serverC/

means that all requests to access A are accordingly converted to access B or C
Finally, restart the apache of server A

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327998.htmlTechArticleAt least three servers are required: Server A: Control server Server B and Server C: Actual implementation of server load balancing principle: Distribute requests to server A to server B and services...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn