小兔网

2021071307302319564390 Redis 服务器

Redis Config Resetstat 命令用于重置 INFO 命令中的某些统计数据,包括:

  • Keyspace hits (键空间命中次数)
  • Keyspace misses (键空间不命中次数)
  • Number of commands processed (执行命令的次数)
  • Number of connections received (连接服务器的次数)
  • Number of expired keys (过期key的数量)
  • Number of rejected connections (被拒绝的连接数量)
  • Latest fork(2) time(最后执行 fork(2) 的时间)
  • The aof_delayed_fsync counter(aof_delayed_fsync 计数器的值)

语法

redis Config Resetstat 命令基本语法如下:

redis 127.0.0.1:6379> CONFIG RESETSTAT

可用版本

>= 2.0.0

返回值

总是返回 OK 。

实例

重置前 INFO 命令输出信息:

redis 127.0.0.1:6379> INFO# Serverredis_version:2.5.3redis_git_sha1:d0407c2dredis_git_dirty:0arch_bits:32multiplexing_api:epollgcc_version:4.6.3process_id:11095run_id:ef1f6b6c7392e52d6001eaf777acbe547d1192e2tcp_port:6379uptime_in_seconds:6uptime_in_days:0lru_clock:1205426# Clientsconnected_clients:1client_longest_output_list:0client_biggest_input_buf:0blocked_clients:0# Memoryused_memory:331076used_memory_human:323.32Kused_memory_rss:1568768used_memory_peak:293424used_memory_peak_human:286.55Kused_memory_lua:16384mem_fragmentation_ratio:4.74mem_allocator:jemalloc-2.2.5# Persistenceloading:0aof_enabled:0changes_since_last_save:0bgsave_in_progress:0last_save_time:1333260015last_bgsave_status:okbgrewriteaof_in_progress:0# Statstotal_connections_received:1total_commands_processed:0instantaneous_ops_per_sec:0rejected_connections:0expired_keys:0evicted_keys:0keyspace_hits:0keyspace_misses:0pubsub_channels:0pubsub_patterns:0latest_fork_usec:0# Replicationrole:masterconnected_slaves:0# CPUused_cpu_sys:0.01used_cpu_user:0.00used_cpu_sys_children:0.00used_cpu_user_children:0.00# Keyspacedb0:keys=20,expires=0<p>执行重置命令:</p><pre>redis 127.0.0.1:6379> CONFIG RESETSTATOK

重置后查看 INFO 命令输出信息:

redis 127.0.0.1:6379> INFO# Serverredis_version:2.5.3redis_git_sha1:d0407c2dredis_git_dirty:0arch_bits:32multiplexing_api:epollgcc_version:4.6.3process_id:11095run_id:ef1f6b6c7392e52d6001eaf777acbe547d1192e2tcp_port:6379uptime_in_seconds:134uptime_in_days:0lru_clock:1205438# Clientsconnected_clients:1client_longest_output_list:0client_biggest_input_buf:0blocked_clients:0# Memoryused_memory:331076used_memory_human:323.32Kused_memory_rss:1568768used_memory_peak:330280used_memory_peak_human:322.54Kused_memory_lua:16384mem_fragmentation_ratio:4.74mem_allocator:jemalloc-2.2.5# Persistenceloading:0aof_enabled:0changes_since_last_save:0bgsave_in_progress:0last_save_time:1333260015last_bgsave_status:okbgrewriteaof_in_progress:0# Statstotal_connections_received:0total_commands_processed:1instantaneous_ops_per_sec:0rejected_connections:0expired_keys:0evicted_keys:0keyspace_hits:0keyspace_misses:0pubsub_channels:0pubsub_patterns:0latest_fork_usec:0# Replicationrole:masterconnected_slaves:0# CPUused_cpu_sys:0.05used_cpu_user:0.02used_cpu_sys_children:0.00used_cpu_user_children:0.00# Keyspacedb0:keys=20,expires=0

2021071307302319564390 Redis 服务器