`

linux memcached查看和清理

    博客分类:
  • java
 
阅读更多
1.一种

  

[plain] view plaincopyprint?
 
  1. telnet localhost 200001 #登陆  
  2.   stats #查看状态  
  3.   flush_all #清理  
  4.   quit #退出  

 

  2.又学到一个:

  echo 'flush_all' | nc localhost 200001

  3.

  1、数据存储(假设key为test,value为12345)

  

[plain] view plaincopyprint?
 
  1. printf "set test 0 0 5\r\n12345\r\n" | nc 127.0.0.1 200001  
  2.   STORED  

 

  2、数据取回(假设key为test)

  

[plain] view plaincopyprint?
 
  1. printf "get test\r\n" | nc 127.0.0.1 200001  
  2.   VALUE test 0 5  
  3.   12345  
  4.   END  

 

  3、数值增加1(假设key为test,并且value为正整数)

  printf "incr test 1\r\n" | nc 127.0.0.1 200001

  12346

  4、数值减少3(假设key为test,并且value为正整数)

 

[plain] view plaincopyprint?
 
  1. printf "decr test 3\r\n" | nc 127.0.0.1 200001  
  2.  12343  

 

  5、数据删除(假设key为test)

  

[plain] view plaincopyprint?
 
  1. printf "delete test\r\n" | nc 127.0.0.1 11211  
  2.   DELETED  

 

  6、查看Memcached状态

 

[plain] view plaincopyprint?
 
  1. printf "stats\r\n" | nc 127.0.0.1 200001  
  2.  STAT pid 3025  
  3.  STAT uptime 4120500  
  4.  STAT time 1228021767  
  5.  STAT version 1.2.6  
  6.  STAT pointer_size 32  
  7.  STAT rusage_user 433.463103  
  8.  STAT rusage_system 1224.515845  
  9.  STAT curr_items 1132460  
  10.  STAT total_items 8980260  
  11.  STAT bytes 1895325386  
  12.  STAT curr_connections 252  
  13.  STAT total_connections 547850  
  14.  STAT connection_structures 1189  
  15.  STAT cmd_get 13619685  
  16.  STAT cmd_set 8980260  
  17.  STAT get_hits 6851607  
  18.  STAT get_misses 6768078  
  19.  STAT evictions 0  
  20.  STAT bytes_read 160396238246  
  21.  STAT bytes_written 260080686529  
  22.  STAT limit_maxbytes 2147483648  
  23.  STAT threads 1  
  24.  END  

 

  7、模拟top命令,查看Memcached状态:

  

[plain] view plaincopyprint?
 
  1. printf "stats\r\n" | nc 127.0.0.1 200001  
  2.   或者  
  3.   watch "echo stats | nc 127.0.0.1 200001"  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics