Memcached命令列表(二)

1.统计命令stats

格式:
stats [<args>]\r\n
STAT <name> <value>\r\n
END\r\n

stats
STAT pid 1014                  //Memcache进程ID
STAT uptime 8122               //Memcached运行时间,单位:秒
STAT time 1357359669           //Memcached当前的UNIX时间
STAT version 1.4.7             //Memcached的版本号
STAT libevent 2.0.19-stable    
STAT pointer_size 64
STAT rusage_user 0.144009      //该进程累计的用户时间,单位:秒
STAT rusage_system 0.064004    //该进程累计的系统时间,单位:秒
STAT curr_connections 10       //当前连接数量
STAT total_connections 34      //Memcached运行以来接受的连接总数
STAT connection_structures 11  //Memcached分配的连接结构的数量
STAT cmd_get 64                //查询请求总数
STAT cmd_set 10                //存储(添加/更新)请求总数
STAT cmd_flush 0               //flush请求总数
STAT get_hits 60               //查询成功获取数据的总次数
STAT get_misses 4              //查询成功未获取到数据的总次数
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 10753          //Memcached从网络读取到的总字节数
STAT bytes_written 227141      //Memcached向网络发送的总字节数
STAT limit_maxbytes 67108864   //Memcached在存储时被允许使用的字节总数
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT bytes 8416                //Memcached当前存储内容所占用字节数
STAT curr_items 4              //Memcached当前存储的内容数量
STAT total_items 7             //Memcached启动以来存储过的内容总数
STAT evictions 0               //LRU释放对象数,用来释放内存
STAT reclaimed 0
END

Memcached命令列表(二)_第1张图片

2.stats settings 查看设置

stats settings
STAT maxbytes 67108864
STAT maxconns 1024
STAT tcpport 11211
STAT udpport 11211
STAT inter NULL
STAT verbosity 0
STAT oldest 0
STAT evictions on
STAT domain_socket NULL
STAT umask 700
STAT growth_factor 1.25
STAT chunk_size 48
STAT num_threads 4
STAT num_threads_per_udp 4
STAT stat_key_prefix :
STAT detail_enabled no
STAT reqs_per_event 20
STAT cas_enabled yes
STAT tcp_backlog 1024
STAT binding_protocol auto-negotiate
STAT auth_enabled_sasl no
STAT item_size_max 1048576
END

3.stats items 数据项统计

stats items
STAT items:1:number 2
STAT items:1:age 7145
STAT items:1:evicted 0
STAT items:1:evicted_nonzero 0
STAT items:1:evicted_time 0
STAT items:1:outofmemory 0
STAT items:1:tailrepairs 0
STAT items:1:reclaimed 0
STAT items:17:number 1
STAT items:17:age 1006
STAT items:17:evicted 0
STAT items:17:evicted_nonzero 0
STAT items:17:evicted_time 0
STAT items:17:outofmemory 0
STAT items:17:tailrepairs 0
STAT items:17:reclaimed 0
STAT items:19:number 1
STAT items:19:age 1010
STAT items:19:evicted 0
STAT items:19:evicted_nonzero 0
STAT items:19:evicted_time 0
STAT items:19:outofmemory 0
STAT items:19:tailrepairs 0
STAT items:19:reclaimed 0
END



4.stats sizes 数据项统计

stats sizes
STAT 96 2
STAT 3328 1
STAT 4960 1
END

格式:STAT <size> <count>

注意:会锁定服务,暂停处理请求

5.stats slabs 数据项统计

stats slabs
STAT 1:chunk_size 96
STAT 1:chunks_per_page 10922
STAT 1:total_pages 1
STAT 1:total_chunks 10922
STAT 1:used_chunks 2
STAT 1:free_chunks 1
STAT 1:free_chunks_end 10919
STAT 1:mem_requested 149
STAT 1:get_hits 8
STAT 1:cmd_set 8
STAT 1:delete_hits 0
STAT 1:incr_hits 0
STAT 1:decr_hits 0
STAT 1:cas_hits 0
STAT 1:cas_badval 0
STAT 17:chunk_size 3632
STAT 17:chunks_per_page 288
STAT 17:total_pages 1
STAT 17:total_chunks 288
STAT 17:used_chunks 1
STAT 17:free_chunks 0
STAT 17:free_chunks_end 287
STAT 17:mem_requested 3311
STAT 17:get_hits 18
STAT 17:cmd_set 1
STAT 17:delete_hits 0
STAT 17:incr_hits 0
STAT 17:decr_hits 0
STAT 17:cas_hits 0
STAT 17:cas_badval 0
STAT 19:chunk_size 5680
STAT 19:chunks_per_page 184
STAT 19:total_pages 1
STAT 19:total_chunks 184
STAT 19:used_chunks 1
STAT 19:free_chunks 0
STAT 19:free_chunks_end 183
STAT 19:mem_requested 4956
STAT 19:get_hits 34
STAT 19:cmd_set 1
STAT 19:delete_hits 0
STAT 19:incr_hits 0
STAT 19:decr_hits 0
STAT 19:cas_hits 0
STAT 19:cas_badval 0
STAT active_slabs 3
STAT total_malloced 3139648
END


被浪费内存数=(total_chunks * chunk_size) - mem_requested
如果太大,需要调整factor

6.其它命令

-version
-flush_all
-quit
-echo|nc 快捷方式
version
VERSION 1.4.7
flush_all
OK
quit
Connection closed by foreign host.
echo flush_all | nc localhost 11211
OK
echo get liu | nc localhost 11210
VALUE liu 32 4
java
END

你可能感兴趣的:(Memcached命令列表(二))