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