Drupal Memcache setup
Memcached
Figure 1. The Memcached client library is responsible for sending requests to the correct servers.
Step
1: Application requests keys foo, bar and baz using the client
library, which calculates key hash values, determining which Memcached
server should receive requests.
Step 2: Memcached client sends parallel requests to all relevant Memcached servers.
Step 3: Memcached servers send responses to the client library.
Step 4: Memcached client library aggregates responses for the application.
Install Memcache with Drupal:
Windows XP:
a. Install the Memcached Service
- Download memcached binaries for Win32 from http://jehiah.cz/projects/memcached-win32/
- Unzip the binaries in a directory (eg. c:\memcached)
- Run the command “c:\memcached\memcached.exe -d install” for installing the service.
- Start the server using “c:\memcached\memcached.exe -d start”
- Server will be listening to port 11211(default)
b. Install memcahe php extension
- Check the php_memcache.dll file is already exists in c:\xampp\php\ext directory. If not download it
- Add following line in you php.ini file “extension=php_memcache.dll”
- Restart the Web Server
c. Install memcahe drupal module
- Put your site in offline
- In php.ini set memcache.hash_strategy="consistent".
- Download memcache module from http://drupal.org/project/memcache
- Edit settings.php by adding following line “$conf['cache_inc'] ='sites/all/modules/memcache/memcache.inc'”
- Put your site back online.
Ubuntu Server:
Note :– Need xampp development version to install pecl packages . If you don’t have development package
a. Install the Memcached Service
- Download memcached from following url http://packages.ubuntu.com/km/lucid/i386/memcached/download
- Run command “dpkg memcached.deb”OR (“apt-get install memcached”)
b. Install memcahe php extension
- Download xampp-linux-devel-1.7.1.tar.gz and copy it to /opt directory
- Download the php distribution package (Same version) and put it in includes/php dir
- Run the command “./configure” (Make sure configure file have execute permission)
- Download memcache pecl extension from http://pecl.php.net/package/memcache
- Extract and run “./configure”, “make”, “make test”, “make install” commands
- Edit your “/opt/lamp/etc/php.ini” file by adding “extension=memcache.so”
- Restart xampp using “/opt/lamp/lamp start”
c. Install memcahe drupal module
- Put your site in offline
- In php.ini set memcache.hash_strategy="consistent".
- Download memcache module from http://drupal.org/project/memcache
- Edit settings.php by adding following line “$conf['cache_inc'] ='sites/all/modules/memcache/memcache.inc'”
- Put your site back online.
Comments