1》 libevent安裝
官網down: http://www.monkey.org
[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
[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