Ahmet Karakaya
Ahmet Karakaya

Reputation: 10139

Apache Loadbalancer with Pure java application

I hava a pure Java application which publishes a webservice without needing any Application server. How can I configure the Apache Http Loadbalancer to forward requests to servers on which this application is installed.

I can handle it when I deploy an webservice over an Application Server such as Glassfish. But I do not know how to do it with pure Java application.

Upvotes: 0

Views: 513

Answers (2)

Ahmet Karakaya
Ahmet Karakaya

Reputation: 10139

here is what I have done so far, which make it happen. Service can be accesed at:

  http://47.168.96.31/StockQuote/StockQuoteService

Installation:

./configure --prefix=/usr/local/apacheHttpServer3 --enable-modules=proxy

Configuration:

<Proxy balancer://kekagent>
      BalancerMember http://47.168.96.31:2020  loadfactor=10
      BalancerMember http://192.168.0.2:2020   loadfactor=10 timeout=2
</Proxy>
ProxyPass /StockQuote/StockQuoteService balancer://kekagent/StockQuote/StockQuoteService

Upvotes: 0

jcern
jcern

Reputation: 7848

You should just be able to use http:// instead of ajp:// in your balancer config, like:

<Proxy balancer://myApp>
  BalancerMember http://47.168.96.31:2020 route=r1
  BalancerMember http://192.168.0.2:2020 route=r2
</Proxy>

or directly forward with proxy like:

ProxyPass / balancer://myApp
ProxyPassReverse / balancer://myApp

Let's say apache is on 47.168.96.31, then you'd access the service as http://47.168.96.31/StockQuote/StockQuoteService

If you'd rather have the service respond at http://47.168.96.31/, you could do:

ProxyPass / balancer://myApp/StockQuote/StockQuoteService
ProxyPassReverse / balancer://myApp/StockQuote/StockQuoteService

Upvotes: 2

Related Questions