memcached
To install memcached, you need to install libevent first:sudo apt-get install libevent-devInstall memcached:
Create control script:mkdir src cd src wget http://memcached.googlecode.com/files/memcached-1.4.0.tar.gz tar xzvf memcached-1.4.0.tar.gz cd memcached-1.4.0 ./configure make sudo make install cd ..
Add the following code:sudo nano /usr/local/bin/memcache.sh
240 is the memory limit for the instance of memcached, the unit is MB.#!/bin/sh case "$1" in start) /usr/local/bin/memcached -d -u root -m 240 -p 11211 ;; stop) killall memcached ;; esac
11211 is the port number.
make it executable :start a memcached instance when the server startup:
sudo chmod +x /usr/local/bin/memcache.sh
add:sudo nano /etc/rc.local
start a memcached instance by running:/usr/local/bin/memcache.sh start
/usr/local/bin/memcache.sh start
PECL memcache extension for PHP
install php-pear if you have not installed it yetinstall PECL memcache :apt-get install php-pear
Edit the php.inipecl install Memcache
add "extension=memcache.so" to it.nano/etc/php5/fpm php.ini file:
Restart nginx and php5-fmp
Memcache API and Integration module
open settings.php of your drupal site ( /sites/default/settings.php ), and add the following to the end of the file :note: you may place './sites/all/modules/memcache/memcache.inc' with 'cache_inc' => './sites/all/modules/memcache/memcache.db.inc' to cache data both to memory and database if your memcache's memory limit is small or the memcached instance go offline often. (See the README.txt of Memcache API and Integration for more details. )$conf = array( 'cache_inc' => './sites/all/modules/memcache/memcache.inc', );
download Memcache API and Integration module from http://drupal.org/project/memcache, install and enable it.
Now, the integration of memcached and your drupal site is done. You can view memcache status from /admin/reports/memcache .
source
No comments:
Post a Comment