7.7.1. Setting up a basic load balancing with Apache

7.7.1.1. Improving the logs

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

The following modules need to be activated in order to do load balancing on several cluster nodes :

Part of an apache configuration to enabled load balancing :

    # Add a http header to explicitly identify the node and be sticky
    Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED

    # Declare the http server pool
    <Proxy "balancer://plf">
      BalancerMember "http://node1:8080" route=node1 acquire=2000 retry=5 keepalive=on ping=30 connectiontimeout=2
      BalancerMember "http://node2:8080" route=node2 acquire=2000 retry=5 keepalive=on ping=30 connectiontimeout=2
      ProxySet stickysession=ROUTEID
    </Proxy>

    # Declare the pool dedicated to the websocket tunnels
    <Proxy "balancer://plf_ws">
      BalancerMember "ws://node1:8080" route=node1 acquire=2000 retry=0 keepalive=on ping=30 connectiontimeout=2 disablereuse=on flushpackets=on
      BalancerMember "ws://node2:8080" route=node2 acquire=2000 retry=0 keepalive=on ping=30 connectiontimeout=2 disablereuse=on flushpackets=on
      ProxySet stickysession=ROUTEID
    </Proxy>

    # Common options
    ProxyRequests           Off
    ProxyPreserveHost       On

    # Declare the redirection for websocket urls, must be declared before the general ProxyPass definition
    ProxyPass /cometd "balancer://plf_ws/cometd"

    # Declare the redirection for the http requests
    ProxyPass               /       "balancer://plf/"
    ProxyPassReverse        /       "balancer://plf/"

        

Note

This configuration must be adapted to you specific needs before you go to production.

All the configuration detail can be found on the Apache configuration page

See also

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus