Overview of Apache built-in Server Load balancer cluster Functions

Source: Internet
Author: User
Apache self-built Server Load balancer cluster function recorded by: xuanfei
I have searched the internet and found that it seems that I seldom talk about the functions of the mod_proxy module. So today I am going to learn how to buy it. Let's talk about the versions earlier than apache2.2, I have more information about the internet. I 'd like to say a few simple words below :)

The following example uses the Reverse Proxy Server Load balancer configured under apachemod_proxy as the configuration instance: at the site www.test.com, we classify the provided content. Different servers are used to provide different content services, you can transfer the requests for http://www.test.com/newsto an internal server whose IP address is 192.168.1.1 and the requests for http://www.test.com/itto the server.
On 192.168.1.2, go to http://www.test.com/lifeto the server 192.168.1.3.
Http://www.test.com/love的 httphttp://www.love.com
Server Load balancer.
First, make sure that the domain name www.test.com has an IP address legally registered on the Apache server interface corresponding to the DNS record, so that all Internet connection requests to www.test.com can be sent to the Apache server.
Add the following settings to the Apache configuration file httpd. conf of the current server:
Proxypass/news http: // 192.168.1.1
Proxypass/It http: // 192.168.1.2
Proxypass/life http: // 192.168.1.3
Proxypass/live http://www.live.com
Note: It is best to add this setting in httpd. after the conf file "section 2", the server 192.168.1.1-3 should also be a WWW server with corresponding functions. When restarting the service, it is best to use the apachectl configtest command to check whether the configuration is correct.

The next step is the new functionality that the mod_proxy_balancer module added to mod_proxy after version 2.2 that I really want to introduce.

First, remove the comment of the module below the main configuration file HTTP. conf
Loadmodule proxy_module modules/mod_proxy.so
Loadmodule proxy_balancer_module modules/mod_proxy_balancer.so
Loadmodule proxy_http_module modules/mod_proxy_http.so

Add the following elements
Proxyrequests off
Proxypass/test balancer: // xuanfei stickysession = JSESSIONID nofailover = on
<Proxy balancer: // xuanfei/>
Balancermember http: // 192.168.28.131 loadfactor = 1
Balancermember http: // 192.168.28.130 loadfactor = 1
</Proxy>
Proxypass is the proxy forwarding URL, which forwards all access/test requests to the cluster balancer: // xuanfei
Loadfactor is the load ratio parameter between hosts, but different indexes are set.
Balancermember is a member of the cluster, that is, cluster server a or server B. The Server Load balancer forwards requests to balancermember according to the Server Load balancer rules.

After configuration, start the apahce service <location/Server-status>
Sethandler server-status
Order deny, allow
Deny from all
Allow from all
</Location>
And access xuanfei/test to view the results returned by applications on the cluster server. Congratulations! The Server Load balancer and cluster have been configured successfully!

You can also add the following elements to the master configuration file of HTTP. conf:
<Location/balancer-Manager>
Sethandler balancer-Manager
Order deny, allow
Deny from all
Allow from all
</Location>
If the configuration is successful, you can enter xuanfei/balancer-manager in the address bar to clearly view the running status of each node :)

You can also add the following elements to the master configuration file of the HTTP. conf file:
<Location/Server-status>
Sethandler server-status
Order deny, allow
Deny from all
Allow from all
</Location>
You can easily observe the current running status of the master server, as long as you enter xuanfei/Server-status in the address bar

Performance Test and comparison report on Apache Server Load balancer cluster with AB

Conclusion: the mod_proxy function module of Apache can implement two different load balancing cluster implementation methods. The first is the form of division of labor and cooperation, different hosts are responsible for different tasks to achieve task division. The second is that different machines perform the same task. When a machine fails, the host can automatically detect that it will not affect the client, however, the first method cannot be implemented, but the first method has the advantage that the primary server does not have the corresponding burden. The second method is because the server only provides the jump guide function, in the image, if he doesn't show you the path, he just tells you that there is a way to get there, but if he can see the person you see, he won't take care of you anymore :). In contrast, the second type of performance is much better than the first type. However, all of them share the same things in the form of N to complete tasks, so your host performance must be better.

Post: http://blog.csdn.net/fafa211/article/details/3997146

Apache self-built Server Load balancer cluster function recorded by: xuanfei
I have searched the internet and found that it seems that I seldom talk about the functions of the mod_proxy module. So today I am going to learn how to buy it. Let's talk about the versions earlier than apache2.2, I have more information about the internet. I 'd like to say a few simple words below :)

The following example uses the Reverse Proxy Server Load balancer configured under apachemod_proxy as the configuration instance: at the site www.test.com, we classify the provided content. Different servers are used to provide different content services, you can transfer the requests for http://www.test.com/newsto an internal server whose IP address is 192.168.1.1 and the requests for http://www.test.com/itto the server.
On 192.168.1.2, go to http://www.test.com/lifeto the server 192.168.1.3.
Http://www.test.com/love的 httphttp://www.love.com
Server Load balancer.
First, make sure that the domain name www.test.com has an IP address legally registered on the Apache server interface corresponding to the DNS record, so that all Internet connection requests to www.test.com can be sent to the Apache server.
Add the following settings to the Apache configuration file httpd. conf of the current server:
Proxypass/news http: // 192.168.1.1
Proxypass/It http: // 192.168.1.2
Proxypass/life http: // 192.168.1.3
Proxypass/live http://www.live.com
Note: It is best to add this setting in httpd. after the conf file "section 2", the server 192.168.1.1-3 should also be a WWW server with corresponding functions. When restarting the service, it is best to use the apachectl configtest command to check whether the configuration is correct.

The next step is the new functionality that the mod_proxy_balancer module added to mod_proxy after version 2.2 that I really want to introduce.

First, remove the comment of the module below the main configuration file HTTP. conf
Loadmodule proxy_module modules/mod_proxy.so
Loadmodule proxy_balancer_module modules/mod_proxy_balancer.so
Loadmodule proxy_http_module modules/mod_proxy_http.so

Add the following elements
Proxyrequests off
Proxypass/test balancer: // xuanfei stickysession = JSESSIONID nofailover = on
<Proxy balancer: // xuanfei/>
Balancermember http: // 192.168.28.131 loadfactor = 1
Balancermember http: // 192.168.28.130 loadfactor = 1
</Proxy>
Proxypass is the proxy forwarding URL, which forwards all access/test requests to the cluster balancer: // xuanfei
Loadfactor is the load ratio parameter between hosts, but different indexes are set.
Balancermember is a member of the cluster, that is, cluster server a or server B. The Server Load balancer forwards requests to balancermember according to the Server Load balancer rules.

After configuration, start the apahce service <location/Server-status>
Sethandler server-status
Order deny, allow
Deny from all
Allow from all
</Location>
And access xuanfei/test to view the results returned by applications on the cluster server. Congratulations! The Server Load balancer and cluster have been configured successfully!

You can also add the following elements to the master configuration file of HTTP. conf:
<Location/balancer-Manager>
Sethandler balancer-Manager
Order deny, allow
Deny from all
Allow from all
</Location>
If the configuration is successful, you can enter xuanfei/balancer-manager in the address bar to clearly view the running status of each node :)

You can also add the following elements to the master configuration file of the HTTP. conf file:
<Location/Server-status>
Sethandler server-status
Order deny, allow
Deny from all
Allow from all
</Location>
You can easily observe the current running status of the master server, as long as you enter xuanfei/Server-status in the address bar

Performance Test and comparison report on Apache Server Load balancer cluster with AB

Conclusion: the mod_proxy function module of Apache can implement two different load balancing cluster implementation methods. The first is the form of division of labor and cooperation, different hosts are responsible for different tasks to achieve task division. The second is that different machines perform the same task. When a machine fails, the host can automatically detect that it will not affect the client, however, the first method cannot be implemented, but the first method has the advantage that the primary server does not have the corresponding burden. The second method is because the server only provides the jump guide function, in the image, if he doesn't show you the path, he just tells you that there is a way to get there, but if he can see the person you see, he won't take care of you anymore :). In contrast, the second type of performance is much better than the first type. However, all of them share the same things in the form of N to complete tasks, so your host performance must be better.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.