Drupal+HAProxy+MemCached
Paquet necessaire
apt-get install apache2 haproxy php5 php5-gd php5-durl libssh2-php
Config pour recuperer le X-Forward-For
sites/default/settings.php $conf['reverse_proxy'] = TRUE; $conf['reverse_proxy_addresses'] = array('10.242.1.194','10.242.1.195');
AutoSlave (repartition lecture/ecriture)
https://ftp.drupal.org/files/projects/autoslave-7.x-1.8.tar.gz
cd /var/www/html/ cp -r sites/all/modules/autoslave/autoslave includes/database/ chown -R www-data:www-data includes/database/autoslave/
$databases['default']['default'] = array ( 'driver' => 'autoslave', 'master' => array('master', 'autoslave'), // Fallback to slaves if master fails (read-only mode) 'slave' => array('autoslave', 'master'), // Fallback to master if slaves fail 'affected tables backend' => 'autoslave.affected_tables.memcache-db-accurate.inc', 'watchdog on shutdown' => TRUE, 'replication lag' => 2, ); $databases['default']['master'] = array ( 'database' => 'drupal', 'username' => 'auf', 'password' => 'XXXXXXXXXXXXXXXXXXXXXXX', 'host' => 'prod-db-master-idneuf', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ); $databases['default']['autoslave'] = array ( 'database' => 'drupal', 'username' => 'haproxy_auf', 'password' => 'XXXXXXXXXXXXXXXXXXXXXX', 'host' => '127.0.0.1', 'port' => '', 'driver' => 'mysql', 'prefix' => '', 'readonly' => TRUE, // Required for system to enter "readonly" mode if master fails. 'tables' => array('sessions', 'semaphore', 'watchdog', 'users', 'history'), ); // Use locking that supports force master $conf['lock_inc'] = 'sites/all/modules/autoslave/memcache-lock.inc'; // Use AutoSlave transactional safe cache wrapper with a memcache backend $conf['cache_backends'][] = 'sites/all/modules/autoslave/autoslave.cache.inc'; $conf['cache_default_class'] = 'AutoslaveCache'; $conf['autoslave_cache_default_class'] = 'MemCacheDrupal';
Memcached
apt-get -y install php5-memcache memcached
Module Drupal : https://ftp.drupal.org/files/projects/memcache-7.x-1.5.tar.gz