Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache load balance

Tags:

apache

4, I tried configuring load balancer in apache web server but unsuccessfully.
In my httpd.conf

LoadModule proxy_module modules/mod_proxy.so

<VirtualHost mysuperwebapp.com:80>
    ServerName mysuperwebapp.com
    <Location /balancer-manager>
        SetHandler balancer-manager
        Order Deny,Allow
        Deny from all
        Allow from .mysuperwebapp.com
    </Location>
    <Proxy balancer://mycluster>
        BalancerMember http://localhost:9999
        BalancerMember http://localhost:9998 status=+H
    </Proxy>
    <Proxy *>
        Order Allow,Deny
        Allow From All
    </Proxy>
    ProxyPreserveHost On
    ProxyPass /balancer-manager !
    ProxyPass / balancer://mycluster/
    ProxyPassReverse / http://localhost:9999/
    ProxyPassReverse / http://localhost:9998/
</VirtualHost>

When I start the apache service, it said that

AH00526: Syntax error on line 184 of /Users/aptos/Documents/workspace/Webserver/conf/httpd.conf:
BalancerMember Can't find 'byrequests' lb method

Can somebody show me where I did incorrectly? Thank you very much.

like image 968
Xitrum Avatar asked Oct 26 '12 21:10

Xitrum


People also ask

What is load balancing in Apache?

Load balancing is the process of distributing traffic across multiple servers for high-availability (HA) and elastic scalability. Many system administrators opt for dedicated software such as HAProxy to incorporate a proxy server.

Can Apache be a load balancer?

Apache load balancer is open source and provides a server application traffic distribution solution. According to recent statistics, it has been utilized in over 100,000 websites.


4 Answers

In my case, I got the error ProxyPass Can't find 'byrequests' lb method as I using proxy_balancer_module module

Error is due to the fact that I missed to uncomment below required modules in httpd.conf

LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so

and

LoadModule slotmem_shm_module modules/mod_slotmem_shm.so

Un commenting above module entries, which are commented by default, in httpd.conf file solved my issue.

(using Apache 2.4.3)

like image 149
manikanta Avatar answered Sep 21 '22 02:09

manikanta


You need to load the mod_proxy_balancer. On distros which support it, the best way is to use a2enmod:

sudo a2enmod proxy_balancer 

It does all the work for you.

like image 41
Jean-Philippe Caruana Avatar answered Sep 21 '22 02:09

Jean-Philippe Caruana


On Apache 2.2, you will need these libraries instead:

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
like image 29
bex Avatar answered Sep 24 '22 02:09

bex


You need to enable below modules in /etc/httpd/conf/httpd.conf file.

LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
like image 42
Nikunj Ranpura Avatar answered Sep 25 '22 02:09

Nikunj Ranpura