memcache 安装配置
下载预备软件:
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
#wgethttp://monkey.org/~provos/libevent-1.4.12-stable.tar.gz
#wgethttp://memcached.googlecode.com/files/memcached-1.4.2.tar.gz
安装libeventshell>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
安装memcachedshell>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
启动memcachedshell>cd =/usr/local/memcached/bin
shell>./memcached -d -m 2048 -u root -l 192.168.1.11 -p 12111 -c 1024 -P /tmp/memcached.pid
运行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<num>监听的TCP端口(缺省:11211)
-d以守护进程方式运行Memcached
-u<username>运行Memcached的账户,非root用户
-m<num>最大的内存使用,单位是MB,缺省是64MB
-c<num>软连接数量,缺省是1024
-v输出警告和错误信息
-vv打印客户端的请求和返回信息
-h打印帮助信息
-i 打印memcached和libevent的版权信息测试:
Ps aux | grep memcachedTelnet 127.0.0.1 11211