You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Sebastian Reitenbach <bu...@web.de> on 2008/03/03 17:56:28 UTC

[users@httpd] problem with mod_proxy_balance and stickysession

Hi,

I'm trying to loadbalance sessions over 5 instances of a WO application server. I'm trying to 
follow these directions:

http://www.markround.com/archives/33-Apache-mod_proxy-balancing-with-PHP-sticky-sessions.html
http://www.johnandcailin.com/blog/john/scaling-drupal-step-two-sticky-load-balancing-apache-mod_proxy

I have the modules mod_proxy, mod_proxy_balance, mod_proxy_http, mod_status and mod_rewrite loaded.

However, the clients are still sent to different instances on nearly each click.
The proxy listens on one https address 192.168.8.149, and the WO application instances are configured
to listen on 5 other http IP address aliases on the same host (150-154).

The proxy is working this far, as I can connect to the proxy, a login page of one of the
WO application instances shows up, and I can also login. But on subsequent clicks in the 
WebUI, I get kicked out. On the instances, I create a cookie using mod_rewrite.
I also enabled RewriteLog, and when I tail this log file, then I see the different instances
rewriting the cookie, and when I take a look at the cookies that the browser got, the cookie is
there and seems to have the expected contents, e.g. the proxy sends me to instance one, the cookie in my browser 
then has the following contents (taken from a Firefox):

Name: BALANCEID
Content: balancer.www1
Domain: .mycompany.de
Path:/
Send For: Any type of connection
Expires: at end of session

However, It seems the instances generate the cookie, and it seems to pass the proxy, but for some reason
the stickysession=BALANCEID parameter to the proxy doesn't seem to get recognized by the proxy itself so
that the sessions are still spread across all instances on any click.


Here the configuration of the Proxy virtual host:
==========================================================================================
<VirtualHost *>
ServerName www.mycompany.de
#  General setup for the virtual host
DocumentRoot "/srv/www/www"
ErrorLog /var/log/apache2/error_log
TransferLog /var/log/apache2/access_log
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /etc/certs/www.mycompany.de.pem
SSLCertificateKeyFile /etc/certs/www.mycompany.de.key
SSLCertificateChainFile /etc/certs/allcerts.pem
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
   SSLOptions +StdEnvVars
</Files>
HostnameLookups Off
UseCanonicalName Off


<Location /balancer-manager>
  SetHandler balancer-manager
</Location>


ProxyRequests Off
<Proxy *>
                AddDefaultCharset off
                Order deny,allow
                Allow from all
</Proxy>

ProxyVia On


<Proxy balancer://mycluster>
  # cluster member 1
  BalancerMember http://www0.mycompany.de:80 route=www1
  BalancerMember http://www1.mycompany.de:80 route=www2
  BalancerMember http://www2.mycompany.de:80 route=www3
  BalancerMember http://www3.mycompany.de:80 route=www4
  BalancerMember http://www4.mycompany.de:80 route=www5
</Proxy>

ProxyPass /balancer-manager !
ProxyPass / balancer://mycluster/ lbmethod=byrequests stickysession=BALANCEID
ProxyPassReverse / http://www0.mycompany.de/
ProxyPassReverse / http://www1.mycompany.de/
ProxyPassReverse / http://www2.mycompany.de/
ProxyPassReverse / http://www3.mycompany.de/
ProxyPassReverse / http://www4.mycompany.de/

</VirtualHost>
==========================================================================================


Here the configuration of two of the five instances:
==========================================================================================
<VirtualHost 192.168.8.150:*>
        ServerName www.mycompany.de
        #  General setup for the virtual host
        DocumentRoot "/srv/www/www"
        ErrorLog /var/log/apache2/error_log
        TransferLog /var/log/apache2/access_log
        HostnameLookups Off
        UseCanonicalName Off
RewriteEngine On
RewriteRule .* - [CO=BALANCEID:balancer.www0:.mycompany.de]
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 3

RewriteLogLevel 3
<IfModule ngobjweb_module.c>
  <LocationMatch ^/OpenGroupware*>
    SetAppPort 20000
    SetHandler ngobjweb-adaptor
  </LocationMatch>
</IfModule>
</VirtualHost>


<VirtualHost 192.168.8.151:*>
        ServerName www.mycompany.de
        #  General setup for the virtual host
        DocumentRoot "/srv/www/www"
        ErrorLog /var/log/apache2/error_log
        TransferLog /var/log/apache2/access_log
        HostnameLookups Off
        UseCanonicalName Off
RewriteEngine On
RewriteRule .* - [CO=BALANCEID:balancer.www1:.mycompany.de]
RewriteLog /var/log/apache2/rewrite.log
RewriteLogLevel 3
<IfModule ngobjweb_module.c>
  <LocationMatch ^/OpenGroupware*>
    SetAppPort 20001
    SetHandler ngobjweb-adaptor
  </LocationMatch>
</IfModule>
</VirtualHost>
==========================================================================================

Also, I do have LogLevel debug, but I do not see the log messages regarding the proxy module
is doing sth, or that it logs that it matches the BALANCEID?

Any hint what I am still missing here?


kind regards
Sebastian
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org