yum install libevent-devel #环境安装libevent-devel
wget http://memcached.org/files/memcached-1.4.33.tar.gz
tar zxvf memcached-1.4.33.tar.gz
cd memcached-1.4.33
./configure --prefix=/usr/local/memcached
安装完成后,可以看到/usr/local目录下多了一个memcached目录,目录结构如下:make && make install
以上命令直接指定了启动所用的ip,内存大小,用户名,连接数,端口等信息。/usr/local/memcached/bin/memcached -d -l 127.0.0.1 -m 800 -u root -c 1024 -p 11211 -P /tmp/memcached.pid
yum -y install memcached
daemon --pidfile ${pidfile} memcached -d -l $IP -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P ${pidfile} $OPTIONS
daemon --pidfile ${pidfile} memcached -d -p 11211 -u root -m 2048 -c $MAXCONN -P ${pidfile} $OPTIONS
保存并重启服务:
service memcached restart
查看:
ps -ef|grep memcached