Redis operation and maintenance and development study notes (6) Monitoring Redis working condition -info command

Redis operation and maintenance and development study notes (6) Monitoring Redis working condition -info command

info server

Redis server-related general information

127.0.0.1:6379> info server
# Server
redis_version:3.2.12  # Redis服务器的版本号。
redis_git_sha1:00000000  # Git SHA1。
redis_git_dirty:0  # GIT脏数据标志
redis_build_id:7897e7d0e13773f 
redis_mode:standalone
os:Linux 3.10.0-957.21.3.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll # Redis使用的事件循环机制。
gcc_version:4.8.5
process_id:29581  # Redis服务器进程的进程号(PID)。
run_id:3739b19f38ecf64bac40b2b7704d799573f2d6c6 # 用于标识Redis服务器的随机值(Redis的哨兵模式和集群模式会使用这个随机值)。
tcp_port:6379 # TCP/IP的监听端口。
uptime_in_seconds:2226082 # Redis服务器启动至今的时间,以秒为单位。
uptime_in_days:25 # Redis服务器启动至今的时间,以天为单位。
hz:10
lru_clock:5319706 # 每分钟都会递增的时钟,用于LRU(Least Recently Used,最近最少使用)缓存管理。
executable:/root/redis-server # Redis服务器的可执行文件的路径。
config_file:/etc/redis.conf # Redis服务器的配置文件的路径。

info client

127.0.0.1:6379> info clients
# Clients
connected_clients:1 # 客户端连接的数量(来自从机的连接除外)
client_longest_output_list:0 # 当前的客户端连接之中,最长的输出列表
client_biggest_input_buf:0 # 当前的客户端连接之中,最大的输入缓冲区
blocked_clients:0 # 由于阻塞调用(BLPOP、BRPOP、BRPOPLPUSH)而等待的客户端的数量。

info memory

127.0.0.1:6379> info memory
# Memory
used_memory:812544 # Redis使用它的内存分配器(可以是标准的libc、jemalloc或tcmalloc分配器)分配的内存总量,以字节为单位。
used_memory_human:793.50K # Redis使用它的内存分配器分配的内存总量,显示为用户易于阅读的格式。
used_memory_rss:2146304 # 操作系统所看到的为Redis分配的内存总量(也被称为“驻留集大小(Resident Set Size)”)。这个内存总量是由诸如top(1)ps(1)之类的工具报告的。
used_memory_rss_human:2.05M  # 操作系统所看到的为Redis分配的内存总量,显示为用户易于阅读的格式。
used_memory_peak:813552 # Redis消耗的内存峰值,以字节为单位。
used_memory_peak_human:794.48K # Redis消耗的内存峰值,显示为用户易于阅读的格式。
total_system_memory:1927405568 # 系统内存总量,以字节为单位
total_system_memory_human:1.80G # 系统内存总量,显示为用户易于阅读的格式
used_memory_lua:37888 # Lua脚本引擎使用的内存总量,以字节为单位。
used_memory_lua_human:37.00K # Lua脚本引擎使用的内存总量,显示为用户易于阅读的格式。
maxmemory:0 # Redis能够使用的最大内存上限(0表示没有限制),以字节为单位。
maxmemory_human:0B # Redis能够使用的最大内存上限,显示为用户易于阅读的格式。
maxmemory_policy:noeviction # Redis使用的内存回收策略,可以是noeviction、allkeys-lru、volatile-lru、allkeys-random、volatile-random或volatile-ttl。
mem_fragmentation_ratio:2.64 # used_memory_rss和used_memory之间的比率。
mem_allocator:jemalloc-3.6.0 # Redis使用的内存分配器,在编译时选择指定。

In the ideal case, the value should used_memory_rss only slightly higher than the value used_memory point. When the resident set memory (rss) much larger than the amount of memory used (used), which means that there are more Redis server memory fragmentation (internal or external), this situation can be estimated by checking the value of mem_fragmentation_ratio. When the memory used (used) much larger than the resident set memory (rss) time, which means that there is a part of Redis memory used by the operating system to swap out the disk: It is expected to generate significant delay.
Because, Redis can not control how it allocates memory mapped to memory pages, when the memory usage soaring, often result in higher used_memory_rss value.
When Redis release the memory, the memory will be returned to the distributor, and the distributor may (or may not) will be returned to the operating system memory. used_memory memory consumption value and the value of the operating system reports there may be some differences. This may be due Redis is being used and free memory, but the memory has not been released to return to the operating system caused. Typically, the Redis can check whether there is such a problem by the value of used_memory_peak.

info persistence

127.0.0.1:6379> info persistence
# Persistence
loading:表示Redis是否正在加载一个转储文件的标志。
rdb_changes_since_last_save:从最近一次转储至今,RDB的修改次数。
rdb_bgsave_in_progress:表示Redis正在保存RDB的标志。
rdb_last_save_time:最近一次成功保存RDB的时间戳,基于Epoch时间。
rdb_last_bgsave_status:最近一次RDB保存操作的状态。
rdb_last_bgsave_time_sec:最近一次RDB保存操作消耗的时间,以秒为单位。
rdb_current_bgsave_time_sec:如果Redis正在执行RDB保存操作,那么这个字段表示已经消耗的时间,以秒为单位。
aof_enabled:表示Redis是否启用AOF日志功能的标志。
aof_rewrite_in_progress:表示Redis是否正在执行一次AOF重写操作的标志。
aof_rewrite_scheduled:表示一旦Redis正在执行的RDB保存操作完成之后,是否就会调度执行AOF重写操作的标志。
aof_last_rewrite_time_sec:最近一次AOF重写操作消耗的时间,以秒为单位。
aof_current_rewrite_time_sec:如果Redis正在执行AOF重写操作,那么这个字段表示已经消耗的时间,以秒为单位。
aof_last_bgrewrite_status:ok:最近一次AOF重写操作的状态。
aof_last_write_status:ok
  • If the AOF enabled, the persistence segments will add additional fields, as follows:
aof_current_size:AOF文件当前的大小。

aof_base_size:最近一次启动或重写时的AOF文件的大小。

aof_pending_rewrite:表示一旦Redis正在执行的RDB保存操作完成之后,是否就会调度执行AOF重写操作的标志。

aof_buffer_length:AOF缓冲区的大小。

aof_rewrite_buffer_length:AOF重写缓冲区的大小。

aof_pending_bio_fsync:表示后台I/O队列中的fsync的暂停任务。

aof_delayed_fsync:被延迟的fsync调用的计数器。
  • If Redis loading operation is being performed, then the persistence segment will add additional fields, as follows:
loading_start_time:开始执行加载转储文件操作的时间戳,基于Epoch时间。

loading_total_bytes:转储文件的总大小。

loading_loaded_bytes:已经加载的转储文件的大小,以字节为单位。

loading_loaded_perc:已经加载的转储文件的百分比。

loading_eta_seconds:预计完成加载转储文件需要消耗的时间,以秒为单位。

info stats

127.0.0.1:6379> info stats
# Stats
total_connections_received:Redis服务器接受的连接总数。
total_commands_processed:Redis服务器处理的命令总数。
instantaneous_ops_per_sec:每秒钟处理的命令数量。
total_net_input_bytes:通过网络接收的数据总量,以字节为单位。
total_net_output_bytes:通过网络发送的数据总量,以字节为单位。
instantaneous_input_kbps:每秒钟接收数据的速率,以kbps为单位。
instantaneous_output_kbps:每秒钟发送数据的速率,以kbps为单位。
rejected_connections:Redis服务器由于maxclients限制而拒绝的连接数量。
sync_full:Redis主机和从机进行完全同步的次数。
sync_partial_ok:Redis服务器接受PSYNC请求的次数。
sync_partial_err:Redis服务器拒绝PSYNC请求的次数。
expired_keys:键过期事件的总数。
evicted_keys:由于maxmemory限制,而被回收内存的键的总数。
keyspace_hits:在主字典中成功查找到键的次数。
keyspace_misses:在主字典中未能成功查找到键的次数。
pubsub_channels:客户端订阅的发布/订阅频道的总数量。
pubsub_patterns:客户端订阅的发布/订阅模式的总数量。
latest_fork_usec:最近一次fork操作消耗的时间,以微秒为单位。
migrate_cached_sockets:迁移已缓存的套接字的数量。

info commandstats

127.0.0.1:6379> info commandstats
# Commandstats
cmdstat_get:calls=5,usec=30,usec_per_call=6.00
cmdstat_set:calls=11,usec=140,usec_per_call=12.73
cmdstat_del:calls=1,usec=5,usec_per_call=5.00
cmdstat_exists:calls=3,usec=10,usec_per_call=3.33
cmdstat_sadd:calls=2,usec=47,usec_per_call=23.50
cmdstat_mset:calls=1,usec=23,usec_per_call=23.00
cmdstat_expire:calls=1,usec=8,usec_per_call=8.00
cmdstat_keys:calls=4,usec=79,usec_per_call=19.75
cmdstat_dbsize:calls=1,usec=2,usec_per_call=2.00
cmdstat_type:calls=2,usec=11,usec_per_call=5.50
cmdstat_info:calls=104,usec=6071,usec_per_call=58.38
cmdstat_ttl:calls=4,usec=20,usec_per_call=5.00
cmdstat_client:calls=5,usec=78,usec_per_call=15.60
cmdstat_command:calls=7,usec=4174,usec_per_call=596.29

info cpu

127.0.0.1:6379> info cpu
# CPU
used_cpu_sys:1300.85
used_cpu_user:780.14
used_cpu_sys_children:0.01
used_cpu_user_children:0.00

info cluster

127.0.0.1:6379> info cluster
# Cluster
cluster_enabled:0 # 表示是否启用Redis集群功能的标志。

info keyspace

127.0.0.1:6379> info keyspace
# Keyspace
db0:keys=6,expires=0,avg_ttl=0 
# 一个XXX表示数据库的编号,第二个XXX表示键的数量,第三个XXX表示具有过期时间的键的数量,第四个XXX表示键的平均生存时间。
Published 257 original articles · won praise 223 · views 320 000 +

Guess you like

Origin blog.csdn.net/csdn_kou/article/details/102753114