命令行查看Memcached运行状态(shell或者telnet) 测试 Memcach
- font size decrease font size increase font size
查看memcached状态的基本命令,通过这个命令可以看到如下信息:
|
stats items
输出各个slab中的item信息。s
stats slabs
输出slab中更详细的item信息
stats sizes
输出所有item的大小和个数
stats cachedump <slab_id> <limit_num>
利用shell命令操作Memcached
1、数据存储(假设key为g,value为12345)
printf "set g 0 0 5\r\n12345\r\n"|nc 127.0.0.1 11211 |
STORED
2、数据取回(假设key为zhangyan)
printf "get g\r\n"|nc 127.0.0.1 11211 |
VALUE g 0 5
12345
END
3、数值增加1(假设key为g,并且value为正整数)
printf "incr g 1\r\n" | nc 127.0.0.1 11211 |
12346
4、数值减少3(假设key为g,并且value为正整数)
printf "decr g 3\r\n" | nc 127.0.0.1 11211 |
12343
5、数据删除(假设key为g)
printf "delete g\r\n" | nc 127.0.0.1 11211 |
DELETED
6、查看Memcached状态
printf "stats\r\n" | 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\r\n' | 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
( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0003 | 415840 | {main}( ) | .../index.php:0 |
2 | 0.0857 | 4721016 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0857 | 4721016 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.3107 | 12449232 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.3121 | 12473592 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.3131 | 12528920 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.3134 | 12557744 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.3241 | 12993152 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.3241 | 12993152 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3333 | 13718352 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3333 | 13718352 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3376 | 14114720 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.3402 | 14135088 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.4216 | 17162704 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.4216 | 17162704 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.4247 | 17342904 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |
- Published in CentOS 6
- Read 2545 times
( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0003 | 415840 | {main}( ) | .../index.php:0 |
2 | 0.0857 | 4721016 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0857 | 4721016 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.3107 | 12449232 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.3121 | 12473592 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.3131 | 12528920 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.3134 | 12557744 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.3241 | 12993152 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.3241 | 12993152 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.3333 | 13718352 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.3333 | 13718352 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.3376 | 14114720 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.3402 | 14135088 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.4216 | 17162704 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.4216 | 17162704 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.4247 | 17342904 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |