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
  1. Download memcached binaries for Win32 from http://jehiah.cz/projects/memcached-win32/
  2. Unzip the binaries in a directory (eg. c:\memcached)
  3. Run the command “c:\memcached\memcached.exe -d install” for installing the service.
  4. Start the server using “c:\memcached\memcached.exe -d start”
  5. Server will be listening to port 11211(default)
b. Install memcahe php extension
  1. Check the php_memcache.dll file is already exists in c:\xampp\php\ext directory. If not download it
  2. Add following line in you php.ini file “extension=php_memcache.dll”
  3. Restart the Web Server
c. Install memcahe drupal module
  1. Put your site in offline
  2. In php.ini set memcache.hash_strategy="consistent".
  3. Download memcache module from http://drupal.org/project/memcache
  4. Edit settings.php by adding following line “$conf['cache_inc'] ='sites/all/modules/memcache/memcache.inc'
  5. 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
  1. Download memcached from following url http://packages.ubuntu.com/km/lucid/i386/memcached/download
  2. Run command “dpkg memcached.deb”OR (“apt-get install memcached”)
b. Install memcahe php extension
  1. Download xampp-linux-devel-1.7.1.tar.gz and copy it to /opt directory
  2. Download the php distribution package (Same version) and put it in includes/php dir
  3. Run the command “./configure” (Make sure configure file have execute permission)
  4. Download memcache pecl extension from http://pecl.php.net/package/memcache
  5. Extract and run “./configure”, “make”, “make test”, “make install” commands
  6. Edit your “/opt/lamp/etc/php.ini” file by adding “extension=memcache.so”
  7. Restart xampp using “/opt/lamp/lamp start”
c. Install memcahe drupal module
  1. Put your site in offline
  2. In php.ini set memcache.hash_strategy="consistent".
  3. Download memcache module from http://drupal.org/project/memcache
  4. Edit settings.php by adding following line “$conf['cache_inc'] ='sites/all/modules/memcache/memcache.inc'
  5. Put your site back online.

Comments

Popular posts from this blog

PHP - How to increase size of POST value in php

D8 KernelEvents constants

D8 - Attach file programmatically to a node