面向工资编程,面向面试学习!

Redis 教程

Redis 教程Redis 简介Redis 安装Redis 配置Redis 数据类型Redis 命令Redis 键(key)Redis DEL 命令Redis Dump 命令Redis EXISTS 命令Redis Expire 命令Redis Expireat 命令Redis Keys 命令Redis PEXPIREAT 命令Redis Move 命令Redis PERSIST 命令Redis Pttl 命令Redis TTL 命令Redis RANDOMKEY 命令Redis Rename 命令Redis Renamenx 命令Redis Type 命令Redis 字符串(String)Redis SET 命令Redis Get 命令Redis Getrange 命令Redis Getset 命令Redis Getbit 命令Redis Mget 命令Redis Setbit 命令Redis Setex 命令Redis Setnx 命令Redis Setrange 命令Redis Strlen 命令Redis Mset 命令Redis Msetnx 命令Redis Psetex 命令Redis Incr 命令Redis Incrby 命令Redis Incrbyfloat 命令Redis Decr 命令Redis Decrby 命令Redis Append 命令Redis 哈希(Hash)Redis Hdel 命令Redis Hexists 命令Redis Hget 命令Redis Hgetall 命令Redis Hincrby 命令Redis Hincrbyfloat 命令Redis Hkeys 命令Redis Hlen 命令Redis Hmget 命令Redis Hmset 命令Redis Hset 命令Redis Hsetnx 命令Redis Hvals 命令Redis 列表(List)Redis Blpop 命令Redis Brpop 命令Redis Brpoplpush 命令Redis Lindex 命令Redis Linsert 命令Redis Llen 命令Redis Lpop 命令Redis Lpush 命令Redis Lpushx 命令Redis Lrange 命令Redis Lrem 命令Redis Lset 命令Redis Ltrim 命令Redis Rpop 命令Redis Rpoplpush 命令Redis Rpush 命令Redis Rpushx 命令Redis 集合(Set)Redis Sadd 命令Redis Scard 命令Redis Sdiff 命令Redis Sdiffstore 命令Redis Sinter 命令Redis Sinterstore 命令Redis Sismember 命令Redis Smembers 命令Redis Smove 命令Redis Spop 命令Redis Srandmember 命令Redis Srem 命令Redis Sunion 命令Redis Sunionstore 命令Redis Sscan 命令Redis 有序集合(sorted set)Redis Zadd 命令Redis Zcard 命令Redis Zcount 命令Redis Zincrby 命令Redis Zinterstore 命令Redis Zlexcount 命令Redis Zrange 命令Redis Zrangebylex 命令Redis Zrangebyscore 命令Redis Zrank 命令Redis Zrem 命令Redis Zremrangebylex 命令Redis Zremrangebyrank 命令Redis Zremrangebyscore 命令Redis Zrevrange 命令Redis Zrevrangebyscore 命令Redis Zrevrank 命令Redis Zscore 命令Redis Zunionstore 命令Redis Zscan 命令Redis HyperLogLogRedis Pfadd 命令Redis Pfcount 命令Redis PFMERGE 命令Redis 发布订阅Redis Psubscribe 命令Redis Pubsub 命令Redis Publish 命令Redis Punsubscribe 命令Redis Subscribe 命令Redis Unsubscribe 命令Redis 事务Redis Discard 命令Redis Exec 命令Redis Multi 命令Redis Unwatch 命令Redis Watch 命令Redis 脚本Redis Eval 命令Redis Evalsha 命令Redis Script Exists 命令Redis Script Flush 命令Redis Script kill 命令Redis Script Load 命令Redis 连接Redis Auth 命令Redis Echo 命令Redis Ping 命令Redis Quit 命令Redis Select 命令Redis 服务器Redis Bgrewriteaof 命令Redis Bgsave 命令Redis Client Kill 命令Redis Client List 命令Redis Client Getname 命令Redis Client Pause 命令Redis Client Setname 命令Redis Cluster Slots 命令Redis Command 命令Redis Command Count 命令Redis Command Getkeys 命令Redis Command Info 命令Redis Config Get 命令Redis Config rewrite 命令Redis Config Set 命令Redis Config Resetstat 命令Redis Dbsize 命令Redis Debug Object 命令Redis Debug Segfault 命令Redis Flushall 命令Redis Flushdb 命令Redis Info 命令Redis Lastsave 命令Redis Monitor 命令Redis Role 命令Redis Save 命令Redis Shutdown 命令Redis Slaveof 命令Redis Showlog 命令Redis Sync 命令Redis Time 命令Redis 数据备份与恢复Redis 安全Redis 性能测试Redis 客户端连接Redis 管道技术Redis 分区Java 使用 RedisPHP 使用 RedisRedis PEXPIRE 命令

Redis Config Resetstat 命令

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
# Server
redis_version:2.5.3
redis_git_sha1:d0407c2d
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
gcc_version:4.6.3
process_id:11095
run_id:ef1f6b6c7392e52d6001eaf777acbe547d1192e2
tcp_port:6379
uptime_in_seconds:6
uptime_in_days:0
lru_clock:1205426

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:331076
used_memory_human:323.32K
used_memory_rss:1568768
used_memory_peak:293424
used_memory_peak_human:286.55K
used_memory_lua:16384
mem_fragmentation_ratio:4.74
mem_allocator:jemalloc-2.2.5

# Persistence
loading:0
aof_enabled:0
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1333260015
last_bgsave_status:ok
bgrewriteaof_in_progress:0

# Stats
total_connections_received:1
total_commands_processed:0
instantaneous_ops_per_sec:0
rejected_connections:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0

# Replication
role:master
connected_slaves:0

# CPU
used_cpu_sys:0.01
used_cpu_user:0.00
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Keyspace
db0:keys=20,expires=0


<p>执行重置命令:</p>
<pre>
redis 127.0.0.1:6379> CONFIG RESETSTAT
OK

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

redis 127.0.0.1:6379> INFO
# Server
redis_version:2.5.3
redis_git_sha1:d0407c2d
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
gcc_version:4.6.3
process_id:11095
run_id:ef1f6b6c7392e52d6001eaf777acbe547d1192e2
tcp_port:6379
uptime_in_seconds:134
uptime_in_days:0
lru_clock:1205438

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:331076
used_memory_human:323.32K
used_memory_rss:1568768
used_memory_peak:330280
used_memory_peak_human:322.54K
used_memory_lua:16384
mem_fragmentation_ratio:4.74
mem_allocator:jemalloc-2.2.5

# Persistence
loading:0
aof_enabled:0
changes_since_last_save:0
bgsave_in_progress:0
last_save_time:1333260015
last_bgsave_status:ok
bgrewriteaof_in_progress:0

# Stats
total_connections_received:0
total_commands_processed:1
instantaneous_ops_per_sec:0
rejected_connections:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0

# Replication
role:master
connected_slaves:0

# CPU
used_cpu_sys:0.05
used_cpu_user:0.02
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Keyspace
db0:keys=20,expires=0

Redis 服务器