You are here

INSTALLATION.txt in Memcache API and Integration 5

Same filename and directory in other branches
  1. 5.2 INSTALLATION.txt
For instructions on how to compile memcached on Debian Etch, see here:
http://www.lullabot.com/articles/how_install_memcache_debian_etch


Fedora memcache + drupal walkthrough

1) Have a look at the background reading

  A - http://www.danga.com/memcached/	  (cache daemon)

  B - http://pecl.php.net/package/memcache  (PHP integration for memcache)

  C - http://drupal.org/project/memcache    (Drupal Module to use memcache)

2) Fedora RPMs are available for A and B above

  http://dag.wieers.com/rpm/packages/memcached/
  http://dag.wieers.com/rpm/packages/php-pecl-memcache/

  I downloaded the SRPMs and rebuilt them.  This may require installing some
  extra RPMs into your system - rpm will tell you.

 1003  wget http://dag.wieers.com/rpm/packages/memcached/memcached-1.2.1-4.rf.src.rpm
 1004  rpmbuild --rebuild memcached-1.2.1-4.rf.src.rpm
 1005  yum install libevent-devel
 1006  rpmbuild --rebuild memcached-1.2.1-4.rf.src.rpm

 1008  wget http://dag.wieers.com/rpm/packages/php-pecl-memcache/php-pecl-memcache-2.0.4-1.rf.src.rpm
 1009  rpmbuild --rebuild php-pecl-memcache-2.0.4-1.rf.src.rpm
 1010  yum install php-devel
 1011  rpmbuild --rebuild php-pecl-memcache-2.0.4-1.rf.src.rpm

3) Installed RPMS

[root@yoursite ~]# rpm -Uvh /usr/src/redhat/RPMS/x86_64/memcached-1.2.1-4.rf.x86_64.rpm /usr/src/redhat/RPMS/x86_64/php-pecl-memcache-2.0.4-1.rf.x86_64.rpm
Preparing...                ########################################### [100%]
   1:php-pecl-memcache      ########################################### [ 50%]
   2:memcached              ########################################### [100%]
[root@yoursite ~]#

4) Verify configuration. Change if required.

[root@yoursite ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="nobody"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
[root@yoursite ~]#

5) Activate memcache

[root@yoursite ~]# service memcached start
Starting Distributed memory caching (memcached):           [  OK  ]
[root@yoursite ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@yoursite ~]#

  Check phpinfo() for memcached status. Mine said

      memcache
      memcache support	enabled
      Active persistent connections 	0
      Revision 	$Revision$

6) Optional. Install and enable 'devel' module. Configure it to show SQL
queries being executed.  Log in, and check out / and /admin - see how many
SQL queries are run.  In my case / took 156 queries, and /admin took 91.
Once you've patched Drupal as described below, even enabling and disabling
the Memcache module won't disable the use of memcache.

7) Download, install, follow steps in README.txt (move include file,
configure settings.php)

    [simon@yoursite ~]$ cd /home/WHOEVER/www/SOMEWEBSITE.com/html/modules/
    [simon@yoursite modules]$ wget -q http://ftp.osuosl.org/pub/drupal/files/projects/memcache-5.x-1.x-dev.tar.gz
    [simon@yoursite modules]$ tar xfz memcache-5.x-1.x-dev.tar.gz
    [simon@yoursite modules]$ cd memcache
    [simon@yoursite memcache]$ mv memcache.inc ../../includes/
    [simon@yoursite modules]$

Apply the default configuration to the bottom of your
DRUPAL/sites/default/settings.php file.  If you have already configured
$cfg, you will need to add the element to the array instead of appending the
whole $cfg.  The example below uses the default localhost:11211 server.

    [simon@yoursite memcache]$ tail -3 ../../sites/default/settings.php
    $conf = array(
      'cache_inc' => './sites/all/modules/memcache/memcache.inc',
    );
    [simon@yoursite memcache]$

8) Enable the drupal module from /admin/build/modules (it's in the "Other"
section) Note that the memcache module only provides some debug output for
administrators to help you see what memcache is doing. It is non-essential
to the functioning of your site, and can be turned off on a production site.

It is, however, *vital* that you enable the module at least once because it runs
hook_install and adds the serialized column to all of your cache tables.

9) Also see the memcache_admin module (distributed with this package) to monitor
memcache statistics.

File

INSTALLATION.txt
View source
  1. For instructions on how to compile memcached on Debian Etch, see here:
  2. http://www.lullabot.com/articles/how_install_memcache_debian_etch
  3. Fedora memcache + drupal walkthrough
  4. 1) Have a look at the background reading
  5. A - http://www.danga.com/memcached/ (cache daemon)
  6. B - http://pecl.php.net/package/memcache (PHP integration for memcache)
  7. C - http://drupal.org/project/memcache (Drupal Module to use memcache)
  8. 2) Fedora RPMs are available for A and B above
  9. http://dag.wieers.com/rpm/packages/memcached/
  10. http://dag.wieers.com/rpm/packages/php-pecl-memcache/
  11. I downloaded the SRPMs and rebuilt them. This may require installing some
  12. extra RPMs into your system - rpm will tell you.
  13. 1003 wget http://dag.wieers.com/rpm/packages/memcached/memcached-1.2.1-4.rf.src.rpm
  14. 1004 rpmbuild --rebuild memcached-1.2.1-4.rf.src.rpm
  15. 1005 yum install libevent-devel
  16. 1006 rpmbuild --rebuild memcached-1.2.1-4.rf.src.rpm
  17. 1008 wget http://dag.wieers.com/rpm/packages/php-pecl-memcache/php-pecl-memcache-2.0.4-1.rf.src.rpm
  18. 1009 rpmbuild --rebuild php-pecl-memcache-2.0.4-1.rf.src.rpm
  19. 1010 yum install php-devel
  20. 1011 rpmbuild --rebuild php-pecl-memcache-2.0.4-1.rf.src.rpm
  21. 3) Installed RPMS
  22. [root@yoursite ~]# rpm -Uvh /usr/src/redhat/RPMS/x86_64/memcached-1.2.1-4.rf.x86_64.rpm /usr/src/redhat/RPMS/x86_64/php-pecl-memcache-2.0.4-1.rf.x86_64.rpm
  23. Preparing... ########################################### [100%]
  24. 1:php-pecl-memcache ########################################### [ 50%]
  25. 2:memcached ########################################### [100%]
  26. [root@yoursite ~]#
  27. 4) Verify configuration. Change if required.
  28. [root@yoursite ~]# cat /etc/sysconfig/memcached
  29. PORT="11211"
  30. USER="nobody"
  31. MAXCONN="1024"
  32. CACHESIZE="64"
  33. OPTIONS=""
  34. [root@yoursite ~]#
  35. 5) Activate memcache
  36. [root@yoursite ~]# service memcached start
  37. Starting Distributed memory caching (memcached): [ OK ]
  38. [root@yoursite ~]# service httpd restart
  39. Stopping httpd: [ OK ]
  40. Starting httpd: [ OK ]
  41. [root@yoursite ~]#
  42. Check phpinfo() for memcached status. Mine said
  43. memcache
  44. memcache support enabled
  45. Active persistent connections 0
  46. Revision $Revision$
  47. 6) Optional. Install and enable 'devel' module. Configure it to show SQL
  48. queries being executed. Log in, and check out / and /admin - see how many
  49. SQL queries are run. In my case / took 156 queries, and /admin took 91.
  50. Once you've patched Drupal as described below, even enabling and disabling
  51. the Memcache module won't disable the use of memcache.
  52. 7) Download, install, follow steps in README.txt (move include file,
  53. configure settings.php)
  54. [simon@yoursite ~]$ cd /home/WHOEVER/www/SOMEWEBSITE.com/html/modules/
  55. [simon@yoursite modules]$ wget -q http://ftp.osuosl.org/pub/drupal/files/projects/memcache-5.x-1.x-dev.tar.gz
  56. [simon@yoursite modules]$ tar xfz memcache-5.x-1.x-dev.tar.gz
  57. [simon@yoursite modules]$ cd memcache
  58. [simon@yoursite memcache]$ mv memcache.inc ../../includes/
  59. [simon@yoursite modules]$
  60. Apply the default configuration to the bottom of your
  61. DRUPAL/sites/default/settings.php file. If you have already configured
  62. $cfg, you will need to add the element to the array instead of appending the
  63. whole $cfg. The example below uses the default localhost:11211 server.
  64. [simon@yoursite memcache]$ tail -3 ../../sites/default/settings.php
  65. $conf = array(
  66. 'cache_inc' => './sites/all/modules/memcache/memcache.inc',
  67. );
  68. [simon@yoursite memcache]$
  69. 8) Enable the drupal module from /admin/build/modules (it's in the "Other"
  70. section) Note that the memcache module only provides some debug output for
  71. administrators to help you see what memcache is doing. It is non-essential
  72. to the functioning of your site, and can be turned off on a production site.
  73. It is, however, *vital* that you enable the module at least once because it runs
  74. hook_install and adds the serialized column to all of your cache tables.
  75. 9) Also see the memcache_admin module (distributed with this package) to monitor
  76. memcache statistics.