licess 发表于 2010-8-23 11:10:30

lnmp0.4 安装memcached

memcached 最新的稳定版:wgethttp://memcached.googlecode.com/files/memcached-1.4.5.tar.gz

   http://code.google.com/p/memcached/downloads/list

安装memcached

tar zxvfmemcached-1.4.5.tar.gz

cd memcached-1.4.5

./configure --prefix=/usr/local/memcached --with-libevent

make

make install

ln -s /usr/local/libevent/lib/libevent-1.4.so.2 /lib/libevent-1.4.so.2

启动 memcached

启动参数说明:

-d 选项是启动一个守护进程,

-m 是分配给Memcache使用的内存数量,单位是MB,默认64MB

-M return error on memory exhausted (rather than removing items)

-u 是运行Memcache的用户,如果当前为root 的话,需要使用此参数指定用户。

-l 是监听的服务器IP地址,默认为所有网卡。

-p 是设置Memcache的TCP监听的端口,最好是1024以上的端口

-c 选项是最大运行的并发连接数,默认是1024

-P 是设置保存Memcache的pid文件

-f chunk size growth factor (default: 1.25)

-I Override the size of each slab page. Adjusts max item size(1.4.2版本新增)



也可以启动多个守护进程,但是端口不能重复

/usr/local/memcached/bin/memcached -d -m 64 -u root -l 127.0.0.1 -p 11211 -c 128 -P /tmp/memcached.pid

设置开机自动启动

vi /etc/rc.d/rc.local

然后在最后增加一句

/usr/local/memcached/bin/memcached -d -m 64 -u root -l 127.0.0.1 -p 11211 -c 128 -P /tmp/memcached.pid


停止memcached 服务kill -9 `cat /tmp/memcached.pid`


ok然后自己下载一个 memcache.php 测试吧。

zleicx 发表于 2011-3-8 00:47:59

回复 1# 的帖子

要使用Memcache就要安装memcached码?
页: [1]
查看完整版本: lnmp0.4 安装memcached