memcache和memcached安装(2)
memcache
Version 2.2.5memcache
Version 2.2.5
下面安装memcached
装memcached首先需要安装安装libevent
如果是centos可以yum安装
# yum install libevent-devel
如果不支持yum的系统,可以这样装libevent
# cd /usr/local/src
# wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
# tar vxf libevent-1.4.12-stable.tar.gz
# cd libevent-1.4.12
# ./configure --prefix=/usr/local/libevent
# make && make install
接续安装memcached
# cd /usr/local/src
# wget http://cloud.github.com/downloads/saberma/saberma.github.com/memcached-1.4.4.tar.gz
# tar vxf memcached-1.4.4.tar.gz
# cd memcached-1.4.4
# ./configure --prefix=/usr/local/memcached
# make && make install
安装完后启动memcached并分配32m内存(32为使用内存数,可按自身情况修改)
/usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root
将memcached加入启动项
# vi /etc/rc.d/rc.local
按键盘上的 i 开始编辑
在最后加入
/usr/local/memcached/bin/memcached -d -m 32 -l 127.0.0.1 -p 11211 -u root
按Esc键,再输入
:wq
保存退出
如果需要,可以reboot一下,不过不用reboot应该已经生效~
加速效果测试
用没有什么负载的Discuz X1做个测试,未启用时
GMT+8, 2010-9-12 09:08, Processed in 0.038893 second(s), 2 queries.
缓存启用后的效果,不过总体感觉VPS上效果不如用eAccelerato缓存加入效果那么明显
GMT+8, 2010-9-12 09:08, Processed in 0.008383 second(s), 2 queries, Memcache On.
大功告成,打完收工!~~
文章来源:http://www.hostloc.com/thread-28027-1-1.html