redis:info详解

来源:互联网 发布:淘宝高仿卖家被诈骗 编辑:程序博客网 时间:2024/05/19 16:38
转自:http://blog.csdn.net/u013820054/article/details/52067146    [root@192.168.56.159 redis6380]redis-cli -a xxx info      # Server      redis_version:3.0.7  redis_version: Redis 服务器版本      redis_git_sha1:00000000  redis_git_sha1: Git SHA1      redis_git_dirty:0  redis_git_dirty: Git dirty flag      redis_build_id:4022fe7523cdeee3        redis_mode:standalone  redis_mode:单机or集群      os:Linux 2.6.32-358.el6.x86_64 x86_64  os: Redis 服务器的宿主操作系统      arch_bits:64  arch_bits: 架构(32 或 64 位)      multiplexing_api:epoll  multiplexing_api: Redis 所使用的事件处理机制      gcc_version:4.4.7  gcc_version: 编译 Redis 时所使用的 GCC 版本      process_id:6206 process_id: 服务器进程的 PID      run_id:4632606198da81ebf80b7e29a352bd58f9d3a6f1  run_id: Redis 服务器的随机标识符(用于 Sentinel 和集群)      tcp_port:6379  tcp_port: TCP/IP 监听端口      uptime_in_seconds:199  uptime_in_seconds: 自 Redis 服务器启动以来,经过的秒数      uptime_in_days:0  uptime_in_days: 自 Redis 服务器启动以来,经过的天数      hz:10      lru_clock:10160707   lru_clock: 以分钟为单位进行自增的时钟,用于 LRU 管理      config_file:/data/redis/redis6379/redis6379.conf  config_file:redis配置文件            # Clients      connected_clients:2  connected_clients: 已连接客户端的数量(不包括通过从属服务器连接的客户端)      client_longest_output_list:0  client_longest_output_list: 当前连接的客户端当中,最长的输出列表      client_biggest_input_buf:0  client_biggest_input_buf: 当前连接的客户端当中,最大输入缓存      blocked_clients:0  blocked_clients: 正在等待阻塞命令(BLPOP、BRPOP、BRPOPLPUSH)的客户端的数量            # Memory      used_memory:1908784   used_memory: 由 Redis 分配器分配的内存总量,以字节(byte)为单位      used_memory_human:1.82M   used_memory_human: 以人类可读的格式返回 Redis 分配的内存总量      used_memory_rss:2289664   used_memory_rss: 从操作系统的角度,返回 Redis 已分配的内存总量(俗称常驻集大小)。这个值和 top 、 ps 等命令的输出一致。      used_memory_peak:1923848   used_memory_peak: Redis 的内存消耗峰值(以字节为单位)      used_memory_peak_human:1.83M   used_memory_peak_human: 以人类可读的格式返回 Redis 的内存消耗峰值      used_memory_lua:36864   used_memory_lua: Lua 引擎所使用的内存大小(以字节为单位)      mem_fragmentation_ratio:1.20   mem_fragmentation_ratio: used_memory_rss 和 used_memory 之间的比率      mem_allocator:jemalloc-3.6.0   mem_allocator: 在编译时指定的, Redis 所使用的内存分配器。可以是 libc 、 jemalloc 或者 tcmalloc 。      在理想情况下, used_memory_rss 的值应该只比 used_memory 稍微高一点儿。      当 rss > used ,且两者的值相差较大时,表示存在(内部或外部的)内存碎片。      内存碎片的比率可以通过 mem_fragmentation_ratio 的值看出。      当 used > rss 时,表示 Redis 的部分内存被操作系统换出到交换空间了,在这种情况下,操作可能会产生明显的延迟。      当 Redis 释放内存时,分配器可能会,也可能不会,将内存返还给操作系统。      如果 Redis 释放了内存,却没有将内存返还给操作系统,那么 used_memory 的值可能和操作系统显示的 Redis 内存占用并不一致。      查看 used_memory_peak 的值可以验证这种情况是否发生。            # Persistence      loading:0   loading:是否正在 load of a dump file 的标记      rdb_changes_since_last_save:0   rdb_changes_since_last_save:自从上次save后rdb change的数量      rdb_bgsave_in_progress:0   rdb_bgsave_in_progress:是否正常进行bgsave      rdb_last_save_time:1469778323   rdb_last_save_time:上次save的unix时间戳      rdb_last_bgsave_status:ok   rdb_last_bgsave_status:rdb上次bgsave的状态      rdb_last_bgsave_time_sec:0   rdb_last_bgsave_time_sec:上次bgsave的持续时间(s)      rdb_current_bgsave_time_sec:-1   rdb_current_bgsave_time_sec:正在bgsave的持续时间(s)      aof_enabled:1   aof_enabled:启用AOF      aof_rewrite_in_progress:0   aof_rewrite_in_progress:AOF rewrite operation是否正在进行      aof_rewrite_scheduled:0   aof_rewrite_scheduled:Flag indicating an AOF rewrite operation will be scheduled once the on-going RDB save is complete.      aof_last_rewrite_time_sec:-1  aof_last_rewrite_time_sec:上次AOF rewrite持续时间      aof_current_rewrite_time_sec:-1   aof_current_rewrite_time_sec:正在进行的AOF rewrite持续时间      aof_last_bgrewrite_status:ok   aof_last_bgrewrite_status:上次AOF rewrite状态      aof_last_write_status:ok      aof_current_size:1021   aof_current_size:AOF当前大小      aof_base_size:1021   aof_base_size:AOF file size on latest startup or rewrite      aof_pending_rewrite:0   aof_pending_rewrite: Flag indicating an AOF rewrite operation will be scheduled once the on-going RDB save is complete.      aof_buffer_length:0   aof_buffer_length: Size of the AOF buffer      aof_rewrite_buffer_length:0      aof_rewrite_buffer_length: Size of the AOF rewrite buffer      aof_pending_bio_fsync:0   aof_pending_bio_fsync: Number of fsync pending jobs in background I/O queue      aof_delayed_fsync:0    aof_delayed_fsync: Delayed fsync counter            If a load operation is on-going, these additional fields will be added:      loading_start_time: Epoch-based timestamp of the start of the load operation      loading_total_bytes: Total file size      loading_loaded_bytes: Number of bytes already loaded      loading_loaded_perc: Same value expressed as a percentage      loading_eta_seconds: ETA in seconds for the load to be complete            # Stats      total_connections_received:5   total_connections_received: Total number of connections accepted by the server      total_commands_processed:192   total_commands_processed: Total number of commands processed by the server      instantaneous_ops_per_sec:1   instantaneous_ops_per_sec: Number of commands processed per second      total_net_input_bytes:6662         total_net_output_bytes:7005      instantaneous_input_kbps:0.04      instantaneous_output_kbps:0.00      rejected_connections:0   rejected_connections: Number of connections rejected because of maxclients limit      sync_full:1      sync_partial_ok:0      sync_partial_err:0      expired_keys:0   expired_keys: Total number of key expiration events      evicted_keys:0   evicted_keys: Number of evicted keys due to maxmemory limit      keyspace_hits:0   keyspace_hits: Number of successful lookup of keys in the main dictionary      keyspace_misses:0   keyspace_misses: Number of failed lookup of keys in the main dictionary      pubsub_channels:0   pubsub_channels: Global number of pub/sub channels with client subscriptions      pubsub_patterns:0   pubsub_patterns: Global number of pub/sub pattern with client subscriptions      latest_fork_usec:141   latest_fork_usec: Duration of the latest fork operation in microseconds      migrate_cached_sockets:0            # Replication      role:master         connected_slaves:1      slave0:ip=192.168.56.159,port=6380,state=online,offset=239,lag=0      master_repl_offset:239      repl_backlog_active:1      repl_backlog_size:1048576      repl_backlog_first_byte_offset:2      repl_backlog_histlen:238            If the instance is a slave, these additional fields are provided:      master_host: Host or IP address of the master      master_port: Master listening TCP port      master_link_status: Status of the link (up/down)      master_last_io_seconds_ago: Number of seconds since the last interaction with master      master_sync_in_progress: Indicate the master is syncing to the slave      If a SYNC operation is on-going, these additional fields are provided:      master_sync_left_bytes: Number of bytes left before syncing is complete      master_sync_last_io_seconds_ago: Number of seconds since last transfer I/O during a SYNC operation      If the link between master and slave is down, an additional field is provided:      master_link_down_since_seconds: Number of seconds since the link is down            # CPU      used_cpu_sys:0.04   used_cpu_sys: System CPU consumed by the Redis server      used_cpu_user:0.16   used_cpu_user:User CPU consumed by the Redis server      used_cpu_sys_children:0.00   used_cpu_sys_children: System CPU consumed by the background processes      used_cpu_user_children:0.00   used_cpu_user_children: User CPU consumed by the background processes            # Cluster      cluster_enabled:0            # Keyspace      db0:keys=19,expires=0,avg_ttl=0      db1:keys=2,expires=0,avg_ttl=0      db2:keys=1,expires=0,avg_ttl=0      # Server      redis_version:2.8.19 ###redis版本号      redis_git_sha1:00000000  ###git SHA1      redis_git_dirty:0   ###git dirty flag      redis_build_id:78796c63e58b72dc      redis_mode:standalone   ###redis运行模式      os:Linux 2.6.32-431.el6.x86_64 x86_64   ###os版本号      arch_bits:64  ###64位架构      multiplexing_api:epoll  ###调用epoll算法      gcc_version:4.4.7   ###gcc版本号      process_id:25899   ###服务器进程PID      run_id:eae356ac1098c13b68f2b00fd7e1c9f93b1c6a2c   ###Redis的随机标识符(用于sentinel和集群)      tcp_port:6379   ###Redis监听的端口号      uptime_in_seconds:6419 ###Redis运行时长(s为单位)      uptime_in_days:0  ###Redis运行时长(天为单位)      hz:10      lru_clock:10737922  ###以分钟为单位的自增时钟,用于LRU管理      config_file:/etc/redis/redis.conf   ###redis配置文件            # Clients      connected_clients:1   ###已连接客户端的数量(不包括通过从属服务器连接的客户端)这个参数也要一定关注,有飙升和明显下降时都会有问题。即使不操作      client_longest_output_list:0   ###当前连接的客户端中最长的输出列表      client_biggest_input_buf:0   ###当前连接的客户端中最大的。输出缓存      blocked_clients:0  ###正在等待阻塞命令(BLPOP、BRPOP、BRPOPLPUSH)的客户端的数量 需监控            # Memory      used_memory:2281560   ###由 Redis 分配器分配的内存总量,以字节(byte)为单位      used_memory_human:2.18M   ###以更友好的格式输出redis占用的内存      used_memory_rss:2699264   ###从操作系统的角度,返回 Redis 已分配的内存总量(俗称常驻集大小)。这个值和 top 、 ps 等命令的输出一致,包含了used_memory和内存碎片。      used_memory_peak:22141272  ### Redis 的内存消耗峰值(以字节为单位)      used_memory_peak_human:21.12M  ###以更友好的格式输出redis峰值内存占用      used_memory_lua:35840  ###LUA引擎所使用的内存大小      mem_fragmentation_ratio:1.18  ###   =used_memory_rss /used_memory 这两个参数都包含保存用户k-v数据的内存和redis内部不同数据结构需要占用的内存,并且RSS指的是包含操作系统给redis实例分配的内存,这里面还包含不连续分配所带来的开销。因此在理想情况下, used_memory_rss 的值应该只比 used_memory 稍微高一点儿。当 rss > used ,且两者的值相差较大时,表示存在(内部或外部的)内存碎片。内存碎片的比率可以通过 mem_fragmentation_ratio 的值看出。当 used > rss 时,表示 Redis 的部分内存被操作系统换出到交换空间了,在这种情况下,操作可能会产生明显的延迟。可以说这个值大于1.5或者小于1都是有问题的。当大于1.5的时候需要择机进行服务器重启。当小于1的时候需要对redis进行数据清理      mem_allocator:jemalloc-3.6.0            # Persistence      loading:0  ###记录服务器是否正在载入持久化文件,1为正在加载      rdb_changes_since_last_save:0   ###距离最近一次成功创建持久化文件之后,产生了多少次修改数据集的操作      rdb_bgsave_in_progress:0   ###记录了服务器是否正在创建 RDB 文件,1为正在进行      rdb_last_save_time:1420023749  ###最近一次成功创建 RDB 文件的 UNIX 时间戳      rdb_last_bgsave_status:ok   ###最近一次创建 RDB 文件的结果是成功还是失败,失败标识为err,这个时候写入redis 的操作可能会停止,因为默认stop-writes-on-bgsave-error是开启的,这个时候如果需要尽快恢复写操作,可以手工将这个选项设置为no。      rdb_last_bgsave_time_sec:0  ###最近一次创建 RDB 文件耗费的秒数      rdb_current_bgsave_time_sec:-1  ###如果服务器正在创建 RDB 文件,那么这个域记录的就是当前的创建操作已经耗费的秒数      aof_enabled:1   ###AOF 是否处于打开状态,1为启用      aof_rewrite_in_progress:0   ###服务器是否正在创建 AOF 文件      aof_rewrite_scheduled:0   ###RDB 文件创建完毕之后,是否需要执行预约的 AOF 重写操作(因为在RDB时aof的rewrite会被阻塞一直到RDB结束)      aof_last_rewrite_time_sec:-1  ###最近一次创建 AOF 文件耗费的时长      aof_current_rewrite_time_sec:-1  ###如果服务器正在创建 AOF 文件,那么这个域记录的就是当前的创建操作已经耗费的秒数      aof_last_bgrewrite_status:ok  ###最近一次创建 AOF 文件的结果是成功还是失败      aof_last_write_status:ok       aof_current_size:176265  ###AOF 文件目前的大小      aof_base_size:176265  ###服务器启动时或者 AOF 重写最近一次执行之后,AOF 文件的大小      aof_pending_rewrite:0  ###是否有 AOF 重写操作在等待 RDB 文件创建完毕之后执行      aof_buffer_length:0   ###AOF 缓冲区的大小      aof_rewrite_buffer_length:0  ###AOF 重写缓冲区的大小      aof_pending_bio_fsync:0  ###后台 I/O 队列里面,等待执行的 fsync 调用数量      aof_delayed_fsync:0###被延迟的 fsync 调用数量      loading_start_time:1441769386   loading启动时间戳      loading_total_bytes:1787767808   loading需要加载数据量      loading_loaded_bytes:1587418182  已经加载的数据量      loading_loaded_perc:88.79 加载百分比      loading_eta_seconds:7   剩余时间            # Stats      total_connections_received:8466  ###服务器已接受的连接请求数量,注意这是个累计值。      total_commands_processed:900668   ###服务器已执行的命令数量,这个数值需要持续监控,如果在一段时间内出现大范围波动说明系统要么出现大量请求,要么出现执行缓慢的操作。      instantaneous_ops_per_sec:1   ###服务器每秒钟执行的命令数量      total_net_input_bytes:82724170      total_net_output_bytes:39509080      instantaneous_input_kbps:0.07      instantaneous_output_kbps:0.02      rejected_connections:0  ###因为最大客户端数量限制而被拒绝的连接请求数量      sync_full:2      sync_partial_ok:0      sync_partial_err:0      expired_keys:0   ###因为过期而被自动删除的数据库键数量      evicted_keys:0   ###因为最大内存容量限制而被驱逐(evict)的键数量。这个数值如果不是0则说明maxmemory被触发,并且    evicted_keys一直大于0,则系统的latency增加,此时可以临时提高最大内存,但这只是临时措施,需要从应用着手分析。      keyspace_hits:0  ###查找数据库键成功的次数。可以计算命中率      keyspace_misses:500000   ###查找数据库键失败的次数。      pubsub_channels:0  ###目前被订阅的频道数量      pubsub_patterns:0  ###目前被订阅的模式数量      latest_fork_usec:402  ###最近一次 fork() 操作耗费的毫秒数            # Replication      role:master   ###如果当前服务器没有在复制任何其他服务器,那么这个域的值就是 master ;否则的话,这个域的值就是 slave 。注意,在创建复制链的时候,一个从服务器也可能是另一个服务器的主服务器      connected_slaves:2   ###2个slaves      slave0:ip=192.168.65.130,port=6379,state=online,offset=1639,lag=1      slave1:ip=192.168.65.129,port=6379,state=online,offset=1639,lag=0      master_repl_offset:1639      repl_backlog_active:1      repl_backlog_size:1048576      repl_backlog_first_byte_offset:2      repl_backlog_histlen:1638            # CPU      used_cpu_sys:41.87  ###Redis 服务器耗费的系统 CPU      used_cpu_user:17.82  ###Redis 服务器耗费的用户 CPU      used_cpu_sys_children:0.01  ###后台进程耗费的系统 CPU      used_cpu_user_children:0.01  ###后台进程耗费的用户 CPU            # Keyspace      db0:keys=3101,expires=0,avg_ttl=0   ###keyspace 部分记录了数据库相关的统计信息,比如数据库的键数量、数据库过期键数量等。对于每个数据库,这个部分都会添加一行此信息