memcached安装与验证
1)、libevent安装
官网down: http://www.monkey.org
我的网盘down:http://pan.baidu.com/s/1qW8syZi
复制代码 代码示例:
[root@jbxue memcachedsource]# tar -zxvf libevent-1.4.13-stable.tar.gz
[root@jbxue memcachedsource]# cd libevent-1.4.13-stable
[root@jbxue memcachedsource]# ./configure --prefix=/usr
[root@jbxue 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@jbxue memcachedsource]# tar -zxvf memcached-1.4.5.tar.gz
[root@jbxue memcachedsource]# cd memcached-1.4.5
[root@jbxue memcached-1.4.5]# ./configure --with-libevent=/usr/lib
[root@jbxue 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。
(www.jb200.com 脚本学堂 收集整理)
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