Memcached安装及使用

Memcached是什么?存在意义?(提供缓存,提高系统性能)

http://blog.developers.api.sina.com.cn/?p=124

linux上安装Memcached:

Memcached官网:http://memcached.org/

本次安装基于1.4.7稳定版本

http://memcached.googlecode.com/files/memcached-1.4.7.tar.gz

另外,Memcached用到了libevent来做socket处理。

libevent官网:http://www.monkey.org/~provos/libevent/

本次安装基于libevent-1.4.13-stable版本

http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

1、先安装libevent

# tar zxvf libevent-1.4.13-stable.tar.gz
# cd libevent-1.4.13-stable
# ./configure –prefix=/usr
# make
# make install

2、安装Memcached

# tar zxvf memcached-1.4.7.tar.gz
# cd memcached-1.4.7
# ./configure –with-libevent=/usr
# make
# make install

3、启动

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


4、关闭

kill `cat /tmp/memcached.pid`


5、测试

[ybt@mj247 gameworld]$ telnet 127.0.0.1 11211

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

set foo 0 0 3

get

STORED

get foo

VALUE foo 0 3

get

END

qou^H^H

ERROR

quit

Connection closed by foreign host.


posted @ 2011-09-23 16:03  ybtyoyo  阅读(218)  评论(0编辑  收藏  举报