Feb 27

Horde cluster with Pound and memcached

Tag: Horde, PHPOtaku @ 9:58

If you want to use Horde on a cluster with more than one webserver you should try Pound as a loadbalancer and memcached as session storage.

Today I am going to show you an example.

We have two webservers (horde1.example.com/192.168.0.80 and horde2.example.com/192.168.0.81) with Horde installed.

On both machines a memcached is listening on port 11211.

On a third server (webmail.example.com/192.168.0.82) we have installed Pound to distribute the load among the two webservers.

This would be the configuration file of Pound:

## see pound(8) for details
 
User            "www-data"
Group           "www-data"
 
## Logging: (goes to syslog by default)
##      0       no logging
##      1       normal
##      2       extended
##      3       Apache-style (common log format)
##LogLevel      1
LogLevel        2
 
LogFacility     local6
 
## check backend every X secs:
Alive           30
 
ListenHTTP
        # webmail.example.com
        Address 192.168.0.82
        Port 80
        Service
                BackEnd
                        # horde1.example.com
                        Address 192.168.0.80
                        Port 80
                        TimeOut 300
                End
                BackEnd
                        # horde2.example.com
                        Address 192.168.0.81
                        Port 80
                        TimeOut 300
                End
                Session
                        Type    COOKIE
                        TTL     1800
                        ID "horde_session_name"
                End
        End
End

On both webservers you have to edit the file config/conf.php to fit the requirements.
This is a snippet with settings you would need for our example.

Snippet of config/conf.php on horde1.example.com/192.168.0.80

$conf['session']['name'] = 'horde_session_name';
$conf['sessionhandler']['params']['hostspec'] = array('127.0.0.1','192.168.0.81');
$conf['sessionhandler']['params']['port'] = array('11211','11211');
$conf['sessionhandler']['params']['persistent'] = true;
$conf['sessionhandler']['params']['compression'] = false;
$conf['sessionhandler']['params']['lock_dir'] = '/tmp';
$conf['sessionhandler']['type'] = 'memcache';

Snippet of config/conf.php on horde2.example.com/192.168.0.81

$conf['session']['name'] = 'horde_session_name';
$conf['sessionhandler']['params']['hostspec'] = array('127.0.0.1','192.168.0.80');
$conf['sessionhandler']['params']['port'] = array('11211','11211');
$conf['sessionhandler']['params']['persistent'] = true;
$conf['sessionhandler']['params']['compression'] = false;
$conf['sessionhandler']['params']['lock_dir'] = '/tmp';
$conf['sessionhandler']['type'] = 'memcache';

Leave a Reply