memcached安装和验证
1》 libevent安装
官网down: http://www.monkey.org
我的网盘down:http://pan.baidu.com/s/1qW8syZi
[root@luozhonghua memcachedsource]# tar -zxvf libevent-1.4.13-stable.tar.gz
[root@luozhonghua memcachedsource]# cd libevent-1.4.13-stable
[root@luozhonghua memcachedsource]# ./configure --prefix=/usr
[root@luozhonghua memcachedsource]# make && make install
#./configure --prefix=/usr && make && make install
这里一定要注意指定--prefix,后面配置memcached的时候就有必要用到。
2》 memcached安装
官网down: http://www.monkey.org
我的网盘down:http://pan.baidu.com/s/1qW8syZi
[root@luozhonghua memcachedsource]# tar -zxvf memcached-1.4.5.tar.gz
[root@luozhonghua memcachedsource]# cd memcached-1.4.5
[root@luozhonghua memcached-1.4.5]# ./configure --with-libevent=/usr/lib
[root@luozhonghua memcached-1.4.5]# make && make install
# ./configure --with-libevent=/usr/lib && make && make install
这里一定要指定libevent的路径,否则启动的时候就有找不到libevent的so文件的错误。
3> memcached 启动
# /usr/local/bin/memcached -m 32m -p 11211 -d -u root -P /var/run/memcached.pid -c 256 -vv
/usr/local/bin/memcached -d -m 512 -p 11211 -u root -c 256 -P /var/run/memcached.pid
4> memcached 关闭
kill -9 `cat /var/run/memcached.pid`
注意。假设`cat /var/run/memcached.pid`值是缓存上一次的就无效,可直接查到pid值=7787
5>測试
5.1> telnet 127.0.0.1 11211
5.2> stats
stats
STAT pid 7787
STAT uptime 470
STAT time 1405273052
STAT version 1.4.5
STAT pointer_size 32
STAT rusage_user 0.002999
STAT rusage_system 0.101984
STAT curr_connections 10
STAT total_connections 12
STAT connection_structures 11
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 0
STAT get_hits 0
STAT get_misses 0
STAT delete_misses 0
STAT delete_hits 0
STAT incr_misses 0
STAT incr_hits 0
STAT decr_misses 0
STAT decr_hits 0
STAT cas_misses 0
STAT cas_hits 0
STAT cas_badval 0
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 27
STAT bytes_written 49
STAT limit_maxbytes 536870912
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
STAT reclaimed 0
END
6》 退出
quit