Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to Configure Apache HTTP Server for Physical Load Balance's VIP

Status
Not open for further replies.

jponnusa

Programmer
Jul 8, 2015
7
QA
Hi,
We we have two Apache WebServers (WebServerA & WebServerB) and Two Tomcat Servers (TomcatA & TomcatB)
F5 LB Connect Both WebServerA & WebServerB
WebServerA Connect TomcatA (using AJP1.3)
WebServerB Connect TomcatB (using AJP1.3)

If TomcatA failed and WebServerA is available then we are getting 503 Error Message. To avoid this Error Message & Failover, we created LB(VIP) for TamcatA & TomcatB and Port is 8080

On WebServer's workers.properties and VirtualHost conf file, we replaced TomcatA and TomcatB details to LB Server Name and Port 8080. But We are getting 503 Error while accessing the Site from WebServer. However, if I directly access LB then its working. Kindly please help to resolve this issue.

We need configuration help to get like this. Kindly please help on this.
WebServer (mod_jk) -> LB Pool (TomcatA & TomcatB :8080) -> TomcatA (AJP1.3) & TomcatB (AJP1.3)

Thanks
Jayaram
 
By 'AJP', are you referring "Apache JavaServer Pages" or something else??


And define what you mean by 'LB(VIP)' please. Sure one could guess at "A Load Balancer using a Virtual IP" but that may not be what you mean.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.
 
ChrisHisrt, AJP is an Apache protocol to talk directly to JVMs.

jponnusa, It's not clear what your setup is. But...

You just need to create a workers properties file on both Apache servers that defines both Tomcat servers as workers. That means both Apache servers will be sending traffic to both Tomcats. That also means if one Tomcat fails, both Apache servers will send traffic to the remaining Tomcat server.

You should also have a physical loadbalancer in front of both Apache servers. This will give you fault tolerance on the Apache layer. Something like a Cisco CSS, Citrix Netscaler, or similar. This physical loadbalancer is where your VIP and vanity URL for your APP will be. Your physical loadbalancer will balance between the two Apaches at port 8080 (or whatever you choose). Both Apaches will load balance to both Tomcats using AJP to port 8009 (or whateevr the AJP port is configured to).

Your [tt]workers.properties[/tt] file should look something like this...

Code:
# Define list of workers that will be used
# for mapping requests
worker.list=loadbalancer,jkstatus

# Define TomcatA
worker.TomcatA.type=ajp13
worker.TomcatA.host=tomcatserverA.your.domain.com
# Use port listed in server.xml
worker.TomcatA.port=8989
worker.TomcatA.lbfactor=10
worker.TomcatA.cachesize=10
worker.TomcatA.cache_timeout=300
worker.TomcatA.socket_keepalive=1
worker.TomcatA.socket_timeout=300
worker.TomcatA.ping_mode=A

# Define TomcatB
worker.TomcatB.type=ajp13
worker.TomcatB.host=tomcatserverB.your.domain.com
# Use port listed in server.xml
worker.TomcatB.port=8989
worker.TomcatB.lbfactor=10
worker.TomcatB.cachesize=10
worker.TomcatB.cache_timeout=300
worker.TomcatB.socket_keepalive=1
worker.TomcatB.socket_timeout=300
worker.TomcatB.ping_mode=A

# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=TomcatA,TomcatB
worker.loadbalancer.sticky_session=1

# Status worker for managing load balancer
worker.jkstatus.type=status

Your AJP port will not be 8080. That's an HTTP port on the Tomcat JVM. Your AJP port is listed in the server's [tt]server.xml[/tt] file.

Code:
<!-- Define an AJP 1.3 Connector on port 8989 -->
<Connector port="8989" protocol="AJP/1.3" redirectPort="443" />

Also, on each Tomcat server, you'll need to define the "jvmroute". This identifies the "worker". In each server's [tt]server.xml[/tt] file, you'll need to make a line like this. Each Tomcat server needs to have a different name that matches the worker name...

Code:
<!-- You should set jvmRoute to support load-balancing via AJP ie : -->
    <Engine name="Catalina" defaultHost="tomcatserverA.your.domain.com" jvmRoute="TomcatA">

This configuration also defines a [tt]jkstatus[/tt] page to let you check the load balancing from a browser.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top