CONFIG RESETSTAT

可用版本: >= 2.0.0
时间复杂度: O(1)

重置 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 计数器的值)

返回值

总是返回 OK

代码示例

重置前

  1. redis 127.0.0.1:6379> INFO
  2. # Server
  3. redis_version:2.5.3
  4. redis_git_sha1:d0407c2d
  5. redis_git_dirty:0
  6. arch_bits:32
  7. multiplexing_api:epoll
  8. gcc_version:4.6.3
  9. process_id:11095
  10. run_id:ef1f6b6c7392e52d6001eaf777acbe547d1192e2
  11. tcp_port:6379
  12. uptime_in_seconds:6
  13. uptime_in_days:0
  14. lru_clock:1205426
  15.  
  16. # Clients
  17. connected_clients:1
  18. client_longest_output_list:0
  19. client_biggest_input_buf:0
  20. blocked_clients:0
  21.  
  22. # Memory
  23. used_memory:331076
  24. used_memory_human:323.32K
  25. used_memory_rss:1568768
  26. used_memory_peak:293424
  27. used_memory_peak_human:286.55K
  28. used_memory_lua:16384
  29. mem_fragmentation_ratio:4.74
  30. mem_allocator:jemalloc-2.2.5
  31.  
  32. # Persistence
  33. loading:0
  34. aof_enabled:0
  35. changes_since_last_save:0
  36. bgsave_in_progress:0
  37. last_save_time:1333260015
  38. last_bgsave_status:ok
  39. bgrewriteaof_in_progress:0
  40.  
  41. # Stats
  42. total_connections_received:1
  43. total_commands_processed:0
  44. instantaneous_ops_per_sec:0
  45. rejected_connections:0
  46. expired_keys:0
  47. evicted_keys:0
  48. keyspace_hits:0
  49. keyspace_misses:0
  50. pubsub_channels:0
  51. pubsub_patterns:0
  52. latest_fork_usec:0
  53.  
  54. # Replication
  55. role:master
  56. connected_slaves:0
  57.  
  58. # CPU
  59. used_cpu_sys:0.01
  60. used_cpu_user:0.00
  61. used_cpu_sys_children:0.00
  62. used_cpu_user_children:0.00
  63.  
  64. # Keyspace
  65. db0:keys=20,expires=0

重置

  1. redis 127.0.0.1:6379> CONFIG RESETSTAT
  2. OK

重置后

  1. redis 127.0.0.1:6379> INFO
  2. # Server
  3. redis_version:2.5.3
  4. redis_git_sha1:d0407c2d
  5. redis_git_dirty:0
  6. arch_bits:32
  7. multiplexing_api:epoll
  8. gcc_version:4.6.3
  9. process_id:11095
  10. run_id:ef1f6b6c7392e52d6001eaf777acbe547d1192e2
  11. tcp_port:6379
  12. uptime_in_seconds:134
  13. uptime_in_days:0
  14. lru_clock:1205438
  15.  
  16. # Clients
  17. connected_clients:1
  18. client_longest_output_list:0
  19. client_biggest_input_buf:0
  20. blocked_clients:0
  21.  
  22. # Memory
  23. used_memory:331076
  24. used_memory_human:323.32K
  25. used_memory_rss:1568768
  26. used_memory_peak:330280
  27. used_memory_peak_human:322.54K
  28. used_memory_lua:16384
  29. mem_fragmentation_ratio:4.74
  30. mem_allocator:jemalloc-2.2.5
  31.  
  32. # Persistence
  33. loading:0
  34. aof_enabled:0
  35. changes_since_last_save:0
  36. bgsave_in_progress:0
  37. last_save_time:1333260015
  38. last_bgsave_status:ok
  39. bgrewriteaof_in_progress:0
  40.  
  41. # Stats
  42. total_connections_received:0
  43. total_commands_processed:1
  44. instantaneous_ops_per_sec:0
  45. rejected_connections:0
  46. expired_keys:0
  47. evicted_keys:0
  48. keyspace_hits:0
  49. keyspace_misses:0
  50. pubsub_channels:0
  51. pubsub_patterns:0
  52. latest_fork_usec:0
  53.  
  54. # Replication
  55. role:master
  56. connected_slaves:0
  57.  
  58. # CPU
  59. used_cpu_sys:0.05
  60. used_cpu_user:0.02
  61. used_cpu_sys_children:0.00
  62. used_cpu_user_children:0.00
  63.  
  64. # Keyspace
  65. db0:keys=20,expires=0