Redis 通过 info 命令查看不同分区的信息
目录
连上 redis 后,通过
info
命令,可以得到以下信息,基本就表示 redis 整体的内容了,如连接情况
,运行环境情况
,占用资源情况
,持久化
、主从复制
、集群
等。
# Server
redis_version:5.0.14
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:13805f02a5193a67
redis_mode:standalone
os:Linux 5.4.0-136-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:10.2.1
process_id:1
run_id:9c7d741ad2d02ba712598d0c1dcc91dcefa77263
tcp_port:6379
uptime_in_seconds:4084400
uptime_in_days:47
hz:10
configured_hz:10
lru_clock:16596856
executable:/data/redis-server
config_file:
# Clients
connected_clients:97
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:2
# Memory
used_memory:243322368
used_memory_human:232.05M
used_memory_rss:202231808
used_memory_rss_human:192.86M
used_memory_peak:256745760
used_memory_peak_human:244.85M
used_memory_peak_perc:94.77%
used_memory_overhead:104837956
used_memory_startup:791592
used_memory_dataset:138484412
used_memory_dataset_perc:57.10%
allocator_allocated:243475136
allocator_active:246149120
allocator_resident:254595072
total_system_memory:67425673216
total_system_memory_human:62.80G
used_memory_lua:36864
used_memory_lua_human:36.00K
used_memory_scripts:296
used_memory_scripts_human:296B
number_of_cached_scripts:1
maxmemory:10737418240
maxmemory_human:10.00G
maxmemory_policy:allkeys-lru
allocator_frag_ratio:1.01
allocator_frag_bytes:2673984
allocator_rss_ratio:1.03
allocator_rss_bytes:8445952
rss_overhead_ratio:0.79
rss_overhead_bytes:-52363264
mem_fragmentation_ratio:0.83
mem_fragmentation_bytes:-41130496
mem_not_counted_for_evict:182
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:1870838
mem_aof_buffer:182
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0
# Persistence
loading:0
rdb_changes_since_last_save:4587
rdb_bgsave_in_progress:0
rdb_last_save_time:1711095424
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:4
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:2617344
aof_enabled:1
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:5
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
aof_last_cow_size:2953216
aof_current_size:171616655
aof_base_size:129590394
aof_pending_rewrite:0
aof_buffer_length:0
aof_rewrite_buffer_length:0
aof_pending_bio_fsync:1
aof_delayed_fsync:13614
# Stats
total_connections_received:370947
total_commands_processed:4331870327
instantaneous_ops_per_sec:3717
total_net_input_bytes:269461084615
total_net_output_bytes:115993880383
instantaneous_input_kbps:291.74
instantaneous_output_kbps:158.08
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:831632
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:3106502015
keyspace_misses:1037739635
pubsub_channels:0
pubsub_patterns:4
latest_fork_usec:7155
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
# Replication
role:master
connected_slaves:0
master_replid:f8def43b42c51100cd66235defd57d8c993c559b
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:208559.281848
used_cpu_user:77604.631504
used_cpu_sys_children:2065.642462
used_cpu_user_children:18641.423609
# Cluster
cluster_enabled:0
# Keyspace
db0:keys=138,expires=133,avg_ttl=1645164
db1:keys=381,expires=381,avg_ttl=52961832966
db2:keys=1178,expires=0,avg_ttl=0
db3:keys=286,expires=286,avg_ttl=5945836
db4:keys=2096353,expires=2,avg_ttl=41274534
db6:keys=32151,expires=0,avg_ttl=0
db12:keys=700,expires=0,avg_ttl=0
分区
对应的会有如下分区:
- server
- clients
- memory
- cpu
- persistance
- stats
- replication
- cluster
- keyspace
info server
主要获取 server 的版本及运行环境、redis内部IO多路复用机制及其他配置信息。
# Server
redis_version:5.0.14
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:13805f02a5193a67
redis_mode:standalone
os:Linux 5.4.0-136-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:10.2.1
process_id:1
run_id:9c7d741ad2d02ba712598d0c1dcc91dcefa77263
tcp_port:6379
uptime_in_seconds:4084548
uptime_in_days:47
hz:10
configured_hz:10
lru_clock:16597004
executable:/data/redis-server
config_file:
info clients
主要获取客户端相关信息,如连接数,buffer、阻塞的客户端数量。
# Clients
connected_clients:96
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:2
info cpu
主要获取 redis 使用 cpu 的情况,包括其子线程使用情况。
# CPU
used_cpu_sys:208575.853297
used_cpu_user:77609.768174
used_cpu_sys_children:2065.883472
used_cpu_user_children:18644.183167
info memory
主要获取 redis 使用内存情况,如分配的内存,限定使用的内存范围,内存淘汰策略,主从复制相关,AOF持久相关。
# Memory
used_memory:243226936
used_memory_human:231.96M
used_memory_rss:202158080
used_memory_rss_human:192.79M
used_memory_peak:256745760
used_memory_peak_human:244.85M
used_memory_peak_perc:94.73%
used_memory_overhead:104759690
used_memory_startup:791592
used_memory_dataset:138467246
used_memory_dataset_perc:57.12%
allocator_allocated:243304560
allocator_active:245968896
allocator_resident:254492672
total_system_memory:67425673216
total_system_memory_human:62.80G
used_memory_lua:36864
used_memory_lua_human:36.00K
used_memory_scripts:296
used_memory_scripts_human:296B
number_of_cached_scripts:1
maxmemory:10737418240
maxmemory_human:10.00G
maxmemory_policy:allkeys-lru
allocator_frag_ratio:1.01
allocator_frag_bytes:2664336
allocator_rss_ratio:1.03
allocator_rss_bytes:8523776
rss_overhead_ratio:0.79
rss_overhead_bytes:-52334592
mem_fragmentation_ratio:0.83
mem_fragmentation_bytes:-41027864
mem_not_counted_for_evict:3574
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:1788372
mem_aof_buffer:3574
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0
info persistence
持久化信息,如 RDB 形式持久化对应的保存时间,是否后台持久化 RDB,或者是 AOF 持久化信息。
# Persistence
loading:0
rdb_changes_since_last_save:803
rdb_bgsave_in_progress:0
rdb_last_save_time:1711096339
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:4
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:2277376
aof_enabled:1
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:5
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
aof_last_cow_size:2953216
aof_current_size:172715228
aof_base_size:129590394
aof_pending_rewrite:0
aof_buffer_length:0
aof_rewrite_buffer_length:0
aof_pending_bio_fsync:0
aof_delayed_fsync:13614
info replication
主从复制的相关信息,根据实际情况而定,测试环境并没有开启主从复制,所以都是一些默认数据。
# Replication
role:master
connected_slaves:0
master_replid:f8def43b42c51100cd66235defd57d8c993c559b
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
info stats
server的状态信息,如总的连接数,处理的命令数,连接实例的操作速率,传输大小,过期键的数量,键的查询miss与hit情况等。
# Stats
total_connections_received:370979
total_commands_processed:4332567583
instantaneous_ops_per_sec:107
total_net_input_bytes:269509044582
total_net_output_bytes:116012635392
instantaneous_input_kbps:7.12
instantaneous_output_kbps:3.08
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:831731
expired_stale_perc:0.01
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:3107029633
keyspace_misses:1037896390
pubsub_channels:0
pubsub_patterns:4
latest_fork_usec:10181
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
info keyspace
每个 db 下对应的键数量及失效过期数量,平均 ttl 的时间
# Keyspace
db0:keys=135,expires=130,avg_ttl=1711166
db1:keys=386,expires=386,avg_ttl=43949943023
db2:keys=1179,expires=0,avg_ttl=0
db3:keys=286,expires=286,avg_ttl=5186735
db4:keys=2096388,expires=2,avg_ttl=40821975
db6:keys=32151,expires=0,avg_ttl=0
db12:keys=700,expires=0,avg_ttl=0
info cluster
标志集群是否开启。
# Cluster
cluster_enabled:0