久久青草精品A片狠狠,日韩欧美视频一区二区,亚洲国码AV日韩,国产精品黄在

幫助中心 >  技術知識庫 >  云服務器 >  服務器教程 >  linux下命令行查看Memcached運行狀態

linux下命令行查看Memcached運行狀態

2016-01-21 17:01:04 11552

stats
查看memcached狀態的基本命令,通過這個命令可以看到如下信息:
STAT pid 22459                             進程ID
STAT uptime 1027046                        服務器運行秒數
STAT time 1273043062                       服務器當前unix時間戳
STAT version 1.4.4                         服務器版本
STAT pointer_size 64                       操作系統字大小(這臺服務器是64位的)
STAT rusage_user 0.040000                  進程累計用戶時間
STAT rusage_system 0.260000                進程累計系統時間
STAT curr_connections 10                   當前打開連接數
STAT total_connections 82                  曾打開的連接總數
STAT connection_structures 13              服務器分配的連接結構數
STAT cmd_get 54                            執行get命令總數
STAT cmd_set 34                            執行set命令總數
STAT cmd_flush 3                           指向flush_all命令總數
STAT get_hits 9                            get命中次數
STAT get_misses 45                         get未命中次數
STAT delete_misses 5                       delete未命中次數
STAT delete_hits 1                         delete命中次數
STAT incr_misses 0                         incr未命中次數
STAT incr_hits 0                           incr命中次數
STAT decr_misses 0                         decr未命中次數
STAT decr_hits 0                           decr命中次數
STAT cas_misses 0      cas未命中次數
STAT cas_hits 0                            cas命中次數
STAT cas_badval 0                          使用擦拭次數
STAT auth_cmds 0
STAT auth_errors 0
STAT bytes_read 15785                      讀取字節總數
STAT bytes_written 15222                   寫入字節總數
STAT limit_maxbytes 1048576                分配的內存數(字節)
STAT accepting_conns 1                     目前接受的鏈接數
STAT listen_disabled_num 0                 
STAT threads 4                             線程數
STAT conn_yields 0
STAT bytes 0                               存儲item字節數
STAT curr_items 0                          item個數
STAT total_items 34                        item總數
STAT evictions 0                           為獲取空間刪除item的總數
 

stats items
輸出各個slab中的item信息。s
stats slabs
輸出slab中更詳細的item信息
stats sizes
輸出所有item的大小和個數
stats cachedump <slab_id> <limit_num>

根據<slab_id>輸出相同的<slab_id>中的item信息。<limit_num>是輸出的個數,當<limit_num>為0是輸出所有的item。

利用shell命令操作Memcached
1、數據存儲(假設key為g,value為12345) 
   
 printf "set g 0 0 5 12345 "|nc 127.0.0.1 11211
    STORED
    2、數據取回(假設key為zhangyan)

printf "get g "|nc 127.0.0.1 11211
    VALUE g 0 5
     12345
     END
    3、數值增加1(假設key為g,并且value為正整數)
   
 printf "incr g 1 " | nc 127.0.0.1 11211
    12346
    4、數值減少3(假設key為g,并且value為正整數)
 
 printf "decr g  3 " | nc 127.0.0.1 11211
    12343
    5、數據刪除(假設key為g)
   
 printf "delete g " | nc 127.0.0.1 11211
    DELETED
    6、查看Memcached狀態
 
 printf "stats " | nc 127.0.0.1 11211
  STAT pid 3025
STAT uptime 4120500
STAT time 1228021767
STAT version 1.2.6
STAT pointer_size 32
STAT rusage_user 433.463103
STAT rusage_system 1224.515845
STAT curr_items 1132460
STAT total_items 8980260
STAT bytes 1895325386
STAT curr_connections 252
STAT total_connections 547850
STAT connection_structures 1189
STAT cmd_get 13619685
STAT cmd_set 8980260
STAT get_hits 6851607
STAT get_misses 6768078
STAT evictions 0
STAT bytes_read 160396238246
STAT bytes_written 260080686529
STAT limit_maxbytes 2147483648
STAT threads 1
END
7、模擬top命令,查看Memcached狀態:
 
 watch "printf stats | nc 127.0.0.1 11211" 
  
  或者
  
   watch "echo stats | nc 127.0.0.1 11211"
一、echo stats items | nc127.0.0.1 11211
STAT items:1:number 998                   Slab Id=1 ; items數量:998(也就是已經存儲了998個key值)
STAT items:1:age 604348                   Slab Id=1 ; 已經存在時間,單位秒
STAT items:1:evicted 0                        Slab Id=1 ; 被踢出的數量
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:6:number 91897              Slab Id=6 ; items數量:91897(也就是已經存儲了91897個key值)
STAT items:6:age 604345                  Slab Id=6 ; 已經存在時間,單位秒
STAT items:6:evicted 0                       Slab Id=6 ; 被踢出的數量
STAT items:6:evicted_nonzero 0
STAT items:6:evicted_time 0
STAT items:6:outofmemory 0
STAT items:6:tailrepairs 0
STAT items:6:reclaimed 0

提交成功!非常感謝您的反饋,我們會繼續努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務,我們很需要您進一步的反饋信息:

在文檔使用中是否遇到以下問題: