How to install Memcached
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.
memcached : High Performance, Distributed Memory Object Cache server package.
perl-Cache-Memcached : Perl client (library) to work with memcached server.
python-memcached : Perl client (library) to work with memcached server.
php-pecl-memcache : PHP extension to work with the Memcached server.
First we need to check if libevent is installed or not?
Try to install it through yum
yum install libevent
If you don’t find it, then we need to download and install it. Type following sequence of commands on your shell
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz tar xfz libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable ./configure make make install
Try to with Yum
yum install memcached
Download and install from source.
wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz tar xfz memcached-1.4.15.tar.gz cd memcached-1.4.15 ./configure make make install
Run Memcached as a daemon (d = daemon, m = memory, u = user, l = IP to listen to, p = port)
memcached -d -m 1024 -u root -l 127.0.0.1 -p 11211
Try to install it through easyapache. Otherwise, use the following steps.
wget http://pecl.php.net/get/memcache-3.0.8.tgz tar zxvf memcache-3.0.8.tgz cd memcache-3.0.8 phpize ./configure make make install
Find the extension as below and if it is not existed, add it in the php.ini.
Restart the Apache services.
service httpd restart
Tomonitor the memcached status
watch “echo stats | nc 127.0.0.1 11211″
$ echo “stats” | nc 127.0.0.1 11211
watch ‘php -r ‘”‘”‘$m=new Memcache;$m->connect(“127.0.0.1″, 11211);print_r($m->getstats());’”‘”