看到 info , 我联想到了域名的后缀,.info 是域名的后缀。我手上大概有200多个域名,每年的域名续费都是一笔沉重的开支啊!不过,我仅仅持有一枚.info域名。而在 redis 的管理中,info 是个非常重要的命令。使用 redis 的系统命令 info 可以对 redis 进行监控,其用法如下所示:

127.0.0.1:6379> info

执行结果会返回 Server、Clients、Memory、Persistence、Stats、Replication、CPU、Keyspace 等八部分的信息。从 info 返回结果中提取相关信息,就可以达到有效监控 redis 的目的。

# Server
redis_version:4.0.2     #Redis 的版本
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:491670ea67155eb0
redis_mode:standalone
os:Linux 3.10.0-957.5.1.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:4.8.5
process_id:13612    # 当前 Redis 服务器进程id
run_id:f2533eb1511b8f89cbc50ca8c43ee06c0d51957c
tcp_port:6379
uptime_in_seconds:2170099
uptime_in_days:25    # 运行时间(天)
hz:10
lru_clock:13721682
executable:/root/software/redis-4.0.2/redis-server    # 当前 Redis 服务器进程对应的程序
config_file:/root/software/redis-4.0.2/./redis.conf   # 当前 Redis 服务器的配置文件

# Clients
connected_clients:25    # 连接的客户端数量
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:9233256
used_memory_human:8.81M    # Redis分配的内存总量
used_memory_rss:13131776
used_memory_rss_human:12.52M
used_memory_peak:10282967
used_memory_peak_human:9.81M
used_memory_peak_perc:89.79%
used_memory_overhead:5162488
used_memory_startup:835258
used_memory_dataset:4070768
used_memory_dataset_perc:48.47%
total_system_memory:3973537792
total_system_memory_human:3.70G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:1.42
mem_allocator:libc
active_defrag_running:0
lazyfree_pending_objects:0

# Persistence
loading:0
rdb_changes_since_last_save:10    # 上次保存数据库之后,执行命令的次数
rdb_bgsave_in_progress:0
rdb_last_save_time:1624334333
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:593920
aof_enabled:0    # redis是否开启了aof
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_last_cow_size:0

# Stats
total_connections_received:11831    # 运行以来连接过的客户端的总数量
total_commands_processed:72591
instantaneous_ops_per_sec:0
total_net_input_bytes:4229222
total_net_output_bytes:549916
instantaneous_input_kbps:0.02
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:9449    # 运行以来过期的 key 的数量
evicted_keys:0
keyspace_hits:7190
keyspace_misses:10974
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:481
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    # 当前实例的角色master还是slave
connected_slaves:0
master_replid:de2b7db6946e14f1789e58dbd22d6a59a96186be
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:1230.91
used_cpu_user:1102.36
used_cpu_sys_children:25.38
used_cpu_user_children:257.94

# Cluster
cluster_enabled:0

# Keyspace    # 各个数据库的 key 的数量,以及带有生存期的 key 的数量
db0:keys=2,expires=0,avg_ttl=0
db1:keys=70126,expires=452,avg_ttl=46069937
db6:keys=1,expires=0,avg_ttl=0
db15:keys=1,expires=0,avg_ttl=0

标签: none

添加新评论