如何监控MemCached的状态
使用MemCached以后,肯定希望知道cache的效果,对于MemCached的一些运行状态进行监控是必要的。MemCached也提供了stats接口输出一些信息,最简单的方式,就是telnet上去输入stats查看:telnet 127.0.0.1 11211Trying 127.0.0.1 ...Connected to memcache_test_host (127.0.0.1 ).Escape character is '^]'.statsSTAT pid 7186STAT uptime 1695STAT time 1238401344STAT version 1.2.6STAT pointer_size 64STAT rusage_user 0.003999STAT rusage_system 0.002999STAT curr_items 1STAT total_items 54STAT bytes 135STAT curr_connections 2STAT total_connections 111STAT connection_structures 4STAT cmd_get 3STAT cmd_set 54STAT get_hits 0STAT get_misses 3STAT evictions 0STAT bytes_read 5957STAT bytes_written 50914STAT limit_maxbytes 2147483648STAT threads 1END这种方式相当的不方便,所以网上就有各种不同客户端接口写的工具,比如用perl写的这个memcache-tool:
./memcached_toolUsage: memcached-tool memcached-tool 10.0.0.5:11211 display # shows slabs memcached-tool 10.0.0.5:11211 # same.(default is display) memcached-tool 10.0.0.5:11211 stats # shows general stats memcached-tool 10.0.0.5:11211 move 7 9 # takes 1MB slab from class #7 # to class #9.You can only move slabs around once memory is totally allocated, and onlyonce the target class is full.(So you can't move from #6 to #9 and #7to #9 at the same itme, since you'd have to wait for #9 to fill fromthe first reassigned page)$ ./memcached_tool 127.0.0.1:11211 stats#127.0.0.1:11211 Field Value bytes 135 bytes_read 5964 bytes_written 51394 cmd_get 3 cmd_set 54 connection_structures 4 curr_connections 3 curr_items 1 evictions 0 get_hits 0 get_misses 3 limit_maxbytes2147483648 pid 7186 pointer_size 64 rusage_system 0.002999 rusage_user 0.003999 threads 1 time1238401521 total_connections 112 total_items 54 uptime 1872 version 1.2.6命令行的方式,在批处理调用的时候比较方便。但是在展现方面还是web方式更加直观有效,所以就有了php写的memcache.php,是的,用一次就知道这是我想要的。
页:
[1]