下载预备软件:
mcached 下载地址: http://www.danga.com/memcached/
bevent 下载地址: http://www.monkey.org/~provos/libevent/
操作系统:SUSE Linux 9 64位
memcached需要libevent的支持,我们需要先安装libevent
先安装 libevent
再安装 Memcached 主程序
源码下载:(最新版)
libevent官网:http://monkey.org/~provos/libevent/
Memcached官网:http://www.danga.com/memcached
# wget http://monkey.org/~provos/libevent-1.4.12-stable.tar.gz
# wget http://memcached.googlecode.com/files/memcached-1.4.2.tar.gz
安装libevent
shell>tar –zxvf libevent-1.4.8-stable.tar.gz //解压源文件包
shell>cd libevent-1.4.8-stable //进入解压后的目录
shell>./configure --prefix=/usr/local/libevent //译后生成的目标文件夹
shell>make
shell>make install
安装memcached
shell>tar –zxvf memcached-1.2.6.tar.gz //解压源文件包
shell>cd memcached-1.2.6 //进入解压后的目录
shell>./configure --with-libevent=/usr/local/libevent --prefix=/usr/local/memcached //设置libevent的位置和编译后生成的目标文件夹
shell>make
shell>make install
启动memcached
shell>cd =/usr/local/memcached/bin
shell>./memcached –d –p 9999 –m 128
运行memcached时报错
“/memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory”
通过使用export将libevent的路径加入 LD_LIBRARY_PATH,命令如下:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: =/usr/local/libevent/lib
关注基本选项
-p
-d 以守护进程方式运行Memcached
-u
-m
-c
-v 输出警告和错误信息
-vv 打印客户端的请求和返回信息
-h 打印帮助信息
-i 打印memcached和libevent的版权信息
测试:
Ps aux | grep memcached
Telnet 127.0.0.1 11211