Memcached en CentOS 5

Breve tutorial sobre como instalar el servicio 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). Se hace sobre un CentOS de 64 bits, para 32 bits sería ligeramente diferente.

# yum install libevent-devel
# cd /usr/local/src
# wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
# cd memcached-1.4.5
# ./configure --prefix=/usr/local/memcached --enable-64bit
# make && make install
# whereis memcached
memcached: /usr/local/memcached
# adduser memcached

Corremos no como daemon sino bajo supervisión de Daemon tools

# mkdir -p /usr/local/supervise/memcached
# cat > /usr/local/supervise/memcached/run << EOF


#!/bin/bash
exec /usr/local/memcached/bin/memcached -u memcached -l 127.0.0.1 -c 1024 -m 128


# EOF
# chmod +x /usr/local/supervise/memcached/run
# ln -s /usr/local/supervise/memcached/ /service/


-bash-3.2# ps axuf |grep mem
root 10067 0.0 0.0 3660 372 ? S 12:36 0:00 | \_ supervise memcached
501 11866 0.0 0.1 68680 1104 ? Sl 12:37 0:00 | \_ /usr/local/memcached/bin/memcached -u memcached -l 127.0.0.1 -c 1024 -m 128

O por otro lado lo arrancamos como daemon.

# vim /etc/rc.local

/usr/local/memcached/bin/memcached -u memcached -d -m 256 -l 127.0.0.1 -p 11211

Leave a Reply

Your email address will not be published. Required fields are marked *