memcache 安装 注意事项

本人实验目标机器:Sun Unix;

默认使用的编译器为CC;(使用此默认编译器并不成功,需改为gcc)

1.安装memcache之前需要安装libevent库。注意需要安装对应支持的版本。我使用的是两个分别是:

libevent-1.4.9-stable.tar.gz(下载:http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz

memcached-1.2.6.tar.gz(下载:http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz

2. 安装 libevent的步骤:

# tar zxvf libevent-1.4.9-stable.tar.gz

# cd libevent-1.4.9-stable

# ./configure --prefix=/usr

# make

# make install

由于CC并不能很好的支持该程序的编译过程,所以,还是回归传统,使用正统gcc:

CC=gcc ./configure --prefix=/usr

3.安装 Memcached

# tar zxvf memcached-1.2.6.tar.gz

# cd memcached-1.2.6

# CC=gcc ./configure --prefix=/usr/

# make
# make install

4.查看是否安装成功:

which memcached  或者通过查看帮助信息:memcached –h

5.试运行 Memcached

memcached -u username

6.检查是否正常启动

# ps – ef | grep memcached

7.使用telnet与memcache通信:

# telnet localhost 11211

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

stats

STAT pid 4402

STAT uptime 1032

STAT time 1231155683

STAT version 1.2.6

STAT pointer_size 32

...

END

8.telnet下数据存取:

set key1 0 180 3

abc

STORED

add key1 0 180 3

xyz

NOT_STORED

get key1

VALUE key1 0 3

abc

END

replace key1 0 180 3

xyz

STORED

get key1

VALUE key1 0 3

xyz

END

delete key1

DELETED

 

posted @ 2010-11-17 16:27  大CC  阅读(462)  评论(0编辑  收藏  举报
木书架 大CC的博客