linux下查看Memcached运行状态

简介: 查看Memcached运行状态的命令是:echo stats | nc 127.0.0.1 11211查看memcached状态的基本命令,通过这个命令可以看到如下信息:STAT pid 22459 ...

查看Memcached运行状态的命令是:echo stats | nc 127.0.0.1 11211

查看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\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

目录
相关文章
|
15天前
|
监控 Unix Linux
Linux操作系统调优相关工具(四)查看Network运行状态 和系统整体运行状态
Linux操作系统调优相关工具(四)查看Network运行状态 和系统整体运行状态
29 0
|
1月前
|
Shell Linux 程序员
【Linux】浅谈shell命令以及运行原理
【Linux】浅谈shell命令以及运行原理
|
2月前
|
自然语言处理 数据挖掘 Linux
ModelScope问题之拷贝到内网linux系统运行代码报错如何解决
本合集将提供ModelScope安装步骤、配置要求和环境准备,以便用户顺利启动ModelScope进行模型开发和测试。
59 0
|
1月前
|
存储 监控 Linux
【Shell 命令集合 系统管理 】⭐⭐⭐Linux 查看当前正在运行的进程信息 ps命令 使用指南
【Shell 命令集合 系统管理 】⭐⭐⭐Linux 查看当前正在运行的进程信息 ps命令 使用指南
42 0
|
29天前
|
Linux 编译器 程序员
【Linux 调试秘籍】深入探索 C++:运行时获取堆栈信息和源代码行数的终极指南
【Linux 调试秘籍】深入探索 C++:运行时获取堆栈信息和源代码行数的终极指南
68 0
|
15天前
|
Linux
Linux操作系统调优相关工具(三)查看IO运行状态相关工具 查看哪个磁盘或分区最繁忙?
Linux操作系统调优相关工具(三)查看IO运行状态相关工具 查看哪个磁盘或分区最繁忙?
21 0
|
2天前
|
Linux 开发工具 C语言
Linux 安装 gcc 编译运行 C程序
Linux 安装 gcc 编译运行 C程序
15 0
|
22天前
|
Ubuntu Unix Linux
【Linux/Ubuntu】Linux/Ubuntu运行python脚本
【Linux/Ubuntu】Linux/Ubuntu运行python脚本
|
22天前
|
Linux
Linux驱动运行灯 Heartbeat
Linux驱动运行灯 Heartbeat
10 0
|
23天前
|
Java Linux
Linux运行jar并选择配置文件
Linux运行jar并选择配置文件
8 1