INFO命令以一种易于计算机解析且易于人类阅读的格式返回有关服务器的信息和统计信息。
info section 在连接redis server后,输入info命令可以查看信息1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 info [section] info server info clients info memory info persistence info stats info replication info cpu info commandstats info cluster info keyspace
info还支持以下section1 2 3 4 5 6 7 info all info default
info返回值(>=2.4) info server 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 redis_version:3.2.10 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:2fc357230b5d7d9e redis_mode:standalone os:Linux 4.1.0-16.el6.ucloud.x86_64 x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.4.7 process_id:11 run_id:b87c240a1585c224b10807f110c5d6e56e5bf16c tcp_port:6379 uptime_in_seconds:130679 uptime_in_days:1 hz:10 lru_clock:9378323 executable:/data/922d93c9-13df-46b1-aa5e-04eca791a3d3/redis-server config_file:/data/922d93c9-13df-46b1-aa5e-04eca791a3d3/redis.conf
info clients 1 2 3 4 5 connected_clients:2 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0
info memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 used_memory:70397800 used_memory_human:67.14M used_memory_rss:13381632 used_memory_rss_human:12.76M used_memory_peak:70509696 used_memory_peak_human:67.24M used_memory_lua:37888 used_memory_lua_human:37.00K maxmemory:17179869184 maxmemory_human:16.00G maxmemory_policy:noeviction mem_fragmentation_ratio:0.19 mem_allocator:jemalloc-4.0.3
info persistence 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 loading:0 rdb_changes_since_last_save:47861539 rdb_bgsave_in_progress:0 rdb_last_save_time:1552751516 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:-1 rdb_current_bgsave_time_sec:-1 aof_enabled:1 aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 aof_last_rewrite_time_sec:-1 aof_current_rewrite_time_sec:-1 aof_last_bgrewrite_status:ok aof_last_write_status:ok aof_current_size:5072527252 aof_base_size:0 aof_pending_rewrite:0 aof_buffer_length:0 aof_rewrite_buffer_length:0 aof_pending_bio_fsync:0 aof_delayed_fsync:0
info stats 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 total_connections_received:11264 total_commands_processed:73803308 instantaneous_ops_per_sec:8054 total_net_input_bytes:5000387001 total_net_output_bytes:5119029997 instantaneous_input_kbps:530.57 instantaneous_output_kbps:478.97 rejected_connections:0 sync_full:1 sync_partial_ok:0 sync_partial_err:0 expired_keys:21817730 evicted_keys:0 keyspace_hits:25773688 keyspace_misses:6 pubsub_channels:0 pubsub_patterns:0 latest_fork_usec:12283 migrate_cached_sockets:0
info replication 1 2 3 4 5 6 7 8 9 role:master connected_slaves:1 slave0:ip=10.10.155.57,port=6379,state=online,offset=4740420472,lag=1 master_repl_offset:4740828912 repl_backlog_active:1 repl_backlog_size:62914560 repl_backlog_first_byte_offset:4677914353 repl_backlog_histlen:62914560
info cpu 1 2 3 4 5 used_cpu_sys:1788.78 used_cpu_user:638.75 used_cpu_sys_children:0.00 used_cpu_user_children:0.00
info commandstats commandsstats部分根据命令类型提供数据统计,包括命令调用次数,总cpu时间,平均每个命令cpu时间,
1 2 3 4 5 6 7 8 9 10 11 12 13 cmdstat_get:calls=9,usec=32,usec_per_call=3.56 cmdstat_set:calls=3,usec=52,usec_per_call=17.33 cmdstat_del:calls=1,usec=3,usec_per_call=3.00 cmdstat_incr:calls=26328979,usec=85602622,usec_per_call=3.25 cmdstat_expire:calls=22557247,usec=42154769,usec_per_call=1.87 cmdstat_auth:calls=6280,usec=12328,usec_per_call=1.96 cmdstat_psync:calls=1,usec=26,usec_per_call=26.00 cmdstat_replconf:calls=150681,usec=268080,usec_per_call=1.78 cmdstat_info:calls=6239,usec=256697,usec_per_call=41.14 cmdstat_ttl:calls=26328982,usec=15140788,usec_per_call=0.58 cmdstat_config:calls=51,usec=1561,usec_per_call=30.61 cmdstat_command:calls=5034,usec=2020156,usec_per_call=401.30
info cluster
info keyspace 1 2 3 db0:keys=263224,expires=263207,avg_ttl=39615
参考
http://redisdoc.com/client_and_server/info.html
https://redis.io/commands/info
https://yq.aliyun.com/articles/414650