Load balancing an app server with Apache web servers

716 views Asked by At

Our current setup has 2 load balanced web servers that point their application requests to a load balancer for 2 web servers

   LB1
   /  \
Web1   Web2
  \   /
   LB2
  /   \
App1  App2

The 3rd party app we use now recommends we switch from a hardware LB on the app portion to software.

(note: Any information from Apache will be cut down a bit to remove IPs, directories, etc. It's just paranoia)

I've added a load balancing configuration that, very cut down, looks like this

<Proxy balancer://mycluster>
BalancerMember ajp://FIRSTIP:8009 route=node1
BalancerMember ajp://SECONDIP:8009 route=node2

ProxySet stickysession=JSESSIONID
</Proxy>

As you can see we're balancing ajp requests. There's a ton of ProxyPass rules after this for various parts of the site.

I have this loaded by the main httpd.conf

In that httpd.conf I have the following modules loaded, in this order

mod_headers.so
mod_proxy.so
mod_proxy_http.so
mod_proxy_balancer.so
mod_proxy_connect.so
mod_proxy_scgi.so
mod_deflate.so
mod_proxy._ajp.so

The problem is that when I put it all in place and try to restart httpd it throws this:

httpd: Syntax error on line 62 of httpd.conf:  Cannot load modules/mod_proxy_ajp.so into server: modules/mod_proxy_ajp.so:  undefined symbol: ajp_send_header

Also of course now all server requests throw 500 and have an error message in error.log:

No protocol handler was valid for the URL /.  If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

I don't see why this is happening. According to research that error should only be thrown if mod_proxy_ajp is being called BEFORE mod_proxy. Since it's the very last thing everything should have been loaded beforehand.

1

There are 1 answers

0
Ruby Yu On

I have fixed it just now by running following

cd /media/httpd-2.4.16/modules/proxy
/usr/apache24/bin/apxs  -c -i -a mod_proxy.c proxy_util.c
/usr/apache24/bin/apxs  -c -i -a mod_proxy_ajp.c ajp*.c
/usr/apache24/bin/apxs  -c -i -a mod_proxy_balancer.c mod_proxy_connect.c mod_proxy_http.c

Hopeful this is useful for others.