Jump to: navigation, search

Configuring Apache Load Balancer

The following is an example of how to configure Apache load balancer that can be positioned in front of GMS nodes for API requests distribution. For configuration of other load balancing solutions, please refer to their documentation.

Configuration of mod_proxy_balancer

Install Apache 2.2 or higher, starting from this version mod_proxy is able to use the extension mod_proxy_balancer. Make sure the following modules are present in your Apache "modules\" folder, upload them in case they are absent:

  • mod_proxy.so
  • mod_proxy_balancer.so

Add the following strings to your Apache configuration "httpd.conf" file in order to load the modules:

  • LoadModule proxy_module modules/mod_proxy.so
  • LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
  • LoadModule proxy_http_module modules/mod_proxy_http.so

Basically you need to add node based configuration, for this add the following to the httpd.conf file:

ProxyPass / balancer://my_cluster/ stickysession=JSESSIONID nofailover=On

<Proxy balancer://my_cluster>
   BalancerMember http://yourjetty1:8080 route=jetty1
   BalancerMember http://yourjetty2:8080 route=jetty2
</Proxy>

Proxy balancer:// - defines the nodes (workers) in the cluster. Each member may be a http:// or ajp:// URL or another balancer:// URL for cascaded load balancing configuration. If the worker name is not set for the Jetty servers, then session affinity (sticky sessions) will not work. The JSESSIONID cookie must have the format <sessionID>.<worker name>, in which worker name has the same value as the route specified in the BalancerMember above (in this case "jetty1" and "jetty2"). As an example: The following can be added to the jetty-web.xml file to set the worker name in case you need session affinity (sticky sessions):

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  <Get name="sessionHandler">
    <Get name="sessionManager">
      <Call name="setIdManager">
        <Arg>
          <New class="org.mortbay.jetty.servlet.HashSessionIdManager">
            <Set name="WorkerName">jetty1</Set>
          </New>
        </Arg>
      </Call>
    </Get>
  </Get>
</Configure>

Load Balancer Management Page

Apache provides balancer-manager support so that the status of balancer can be viewed on a web page. The following configuration enables this UI at /balancer URL:

<Location /balancer>
SetHandler balancer-manager

 Order Deny,Allow
 Deny from all
 Allow from all
 </Location>
This page was last edited on December 11, 2019, at 17:05.
Comments or questions about this documentation? Contact us for support!