TLD
TLD

Reputation: 8135

Apache load balance

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.

Upvotes: 27

Views: 32229

Answers (5)

Nikunj Ranpura
Nikunj Ranpura

Reputation: 95

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

Upvotes: 1

user2984789
user2984789

Reputation: 1

The Answer is to include

LoadModule proxy_balancer_module modules/mod_proxy_balancer.so

Or for IBM WebSPhere

LoadModule proxy_balancer_module modules/WebSphereCE/mod_proxy_balancer.so

Upvotes: 0

Jean-Philippe Caruana
Jean-Philippe Caruana

Reputation: 2706

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.

Upvotes: 8

bex
bex

Reputation: 41

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

Upvotes: 4

manikanta
manikanta

Reputation: 8500

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)

Upvotes: 36

Related Questions