runoops.com

Redis 服务器

Redis 服务器命令主要是用于管理 redis 服务。

实例

以下实例演示了如何获取 redis 服务器的统计信息:

127.0.0.1:6379> info
# Server
redis_version:5.0.9
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:62759301844d7139
redis_mode:standalone
os:Darwin 18.7.0 x86_64
arch_bits:64
multiplexing_api:kqueue
atomicvar_api:atomic-builtin
gcc_version:4.2.1
process_id:425
run_id:ba2a03630cc0649195b9aeed8f9fb1909584dbc7
tcp_port:6379
uptime_in_seconds:6908
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:16040942
executable:/usr/local/opt/redis/bin/redis-server
config_file:/usr/local/etc/redis.conf

# Clients
connected_clients:1
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:0

# Memory
used_memory:1182704
used_memory_human:1.13M
used_memory_rss:3170304
used_memory_rss_human:3.02M
used_memory_peak:1182704
used_memory_peak_human:1.13M
used_memory_peak_perc:100.04%
used_memory_overhead:1040086
used_memory_startup:989040
used_memory_dataset:142618
used_memory_dataset_perc:73.64%
allocator_allocated:1136672
allocator_active:3129344
allocator_resident:3129344
total_system_memory:8589934592
total_system_memory_human:8.00G
used_memory_lua:40960
used_memory_lua_human:40.00K
used_memory_scripts:152
used_memory_scripts_human:152B
number_of_cached_scripts:1
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:2.75
allocator_frag_bytes:1992672
allocator_rss_ratio:1.00
allocator_rss_bytes:0
rss_overhead_ratio:1.01
rss_overhead_bytes:40960
mem_fragmentation_ratio:2.79
mem_fragmentation_bytes:2033632
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_clients_slaves:0
mem_clients_normal:49694
mem_aof_buffer:0
mem_allocator:libc
active_defrag_running:0
lazyfree_pending_objects:0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1593098427
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size:0
aof_enabled:0
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:1
total_commands_processed:10
instantaneous_ops_per_sec:0
total_net_input_bytes:325
total_net_output_bytes:11708
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:665
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:89b95c1fa9f6ae32908cbe5ebc0f3dbd3e67e848
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:2.415020
used_cpu_user:1.579911
used_cpu_sys_children:0.001420
used_cpu_user_children:0.000807

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=18,expires=0,avg_ttl=0
db2:keys=2,expires=2,avg_ttl=47553874978