redis-stat是一个用Ruby编写的简单的Redis监控工具。
它基于Redis的INFO命令,因此与基于MONITOR命令的其他监视工具不同,它通常不会影响Redis实例的性能。
redis-stat允许您监视Redis单实例和集群。
*或者使用终端的vmstat-like输出
*或者通过嵌入式Web服务器提供的仪表板页面
github源码地址:
redis-stst github地址
参考博客:
redis集群及redis集群监控redis-stat搭建
0,安装redis 参考此篇文章:centos7 安装redis
1,安装ruby gem
yum install ruby ruby-devel rubygem
2,升级ruby到2.4参考此篇文章:升级ruby到2.4 版本
3,安装ruby和redis之间通信工具
#更换gem源,使用国内镜像源下载更快
gem source -a https://ruby.taobao.org/ #添加淘宝源
gem source -r http://rubygems.org/ #删除境外源
[root@localhost ~]# gem install redis --version 3.0.0 #默认最新是4.0版本
Fetching: redis-3.0.0.gem (100%)
Successfully installed redis-3.0.0
Parsing documentation for redis-3.0.0
Installing ri documentation for redis-3.0.0
Done installing documentation for redis after 1 seconds
1 gem installed
4,安装redis-stat
[root@localhost ~]# gem install redis-stat
Fetching: ansi256-0.2.5.gem (100%)
Successfully installed ansi256-0.2.5
Fetching: redis-3.0.7.gem (100%)
Successfully installed redis-3.0.7
Fetching: unicode-display_width-1.3.2.gem (100%)
Successfully installed unicode-display_width-1.3.2
Fetching: tabularize-0.2.10.gem (100%)
Successfully installed tabularize-0.2.10
Fetching: insensitive_hash-0.3.3.gem (100%)
Successfully installed insensitive_hash-0.3.3
Fetching: parallelize-0.4.1.gem (100%)
Successfully installed parallelize-0.4.1
Fetching: si-0.1.4.gem (100%)
Successfully installed si-0.1.4
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: rack-1.6.10.gem (100%)
Successfully installed rack-1.6.10
Fetching: rack-protection-1.5.5.gem (100%)
Successfully installed rack-protection-1.5.5
Fetching: sinatra-1.3.6.gem (100%)
Successfully installed sinatra-1.3.6
Fetching: json-1.8.6.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-1.8.6
Fetching: option_initializer-1.5.1.gem (100%)
Successfully installed option_initializer-1.5.1
Fetching: lps-0.2.1.gem (100%)
Successfully installed lps-0.2.1
Fetching: multi_json-1.13.1.gem (100%)
Successfully installed multi_json-1.13.1
Fetching: multipart-post-2.0.0.gem (100%)
Successfully installed multipart-post-2.0.0
Fetching: faraday-0.15.0.gem (100%)
Successfully installed faraday-0.15.0
Fetching: elasticsearch-transport-1.0.18.gem (100%)
Successfully installed elasticsearch-transport-1.0.18
Fetching: elasticsearch-api-1.0.18.gem (100%)
Successfully installed elasticsearch-api-1.0.18
Fetching: elasticsearch-1.0.18.gem (100%)
Successfully installed elasticsearch-1.0.18
Fetching: daemons-1.1.9.gem (100%)
Successfully installed daemons-1.1.9
Fetching: eventmachine-1.2.6.gem (100%)
Building native extensions. This could take a while...
Successfully installed eventmachine-1.2.6
Fetching: thin-1.5.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed thin-1.5.1
Fetching: redis-stat-0.4.14.gem (100%)
Successfully installed redis-stat-0.4.14
Parsing documentation for ansi256-0.2.5
Installing ri documentation for ansi256-0.2.5
Parsing documentation for redis-3.0.7
Installing ri documentation for redis-3.0.7
Parsing documentation for unicode-display_width-1.3.2
Installing ri documentation for unicode-display_width-1.3.2
Parsing documentation for tabularize-0.2.10
Installing ri documentation for tabularize-0.2.10
Parsing documentation for insensitive_hash-0.3.3
Installing ri documentation for insensitive_hash-0.3.3
Parsing documentation for parallelize-0.4.1
Installing ri documentation for parallelize-0.4.1
Parsing documentation for si-0.1.4
Installing ri documentation for si-0.1.4
Parsing documentation for tilt-1.4.1
Installing ri documentation for tilt-1.4.1
Parsing documentation for rack-1.6.10
Installing ri documentation for rack-1.6.10
Parsing documentation for rack-protection-1.5.5
Installing ri documentation for rack-protection-1.5.5
Parsing documentation for sinatra-1.3.6
Installing ri documentation for sinatra-1.3.6
Parsing documentation for json-1.8.6
Installing ri documentation for json-1.8.6
Parsing documentation for option_initializer-1.5.1
Installing ri documentation for option_initializer-1.5.1
Parsing documentation for lps-0.2.1
Installing ri documentation for lps-0.2.1
Parsing documentation for multi_json-1.13.1
Installing ri documentation for multi_json-1.13.1
invalid options: -SHN
(invalid options are ignored)
Parsing documentation for multipart-post-2.0.0
Installing ri documentation for multipart-post-2.0.0
Parsing documentation for faraday-0.15.0
Installing ri documentation for faraday-0.15.0
Parsing documentation for elasticsearch-transport-1.0.18
Installing ri documentation for elasticsearch-transport-1.0.18
Parsing documentation for elasticsearch-api-1.0.18
Installing ri documentation for elasticsearch-api-1.0.18
Parsing documentation for elasticsearch-1.0.18
Installing ri documentation for elasticsearch-1.0.18
Parsing documentation for daemons-1.1.9
Installing ri documentation for daemons-1.1.9
Parsing documentation for eventmachine-1.2.6
Installing ri documentation for eventmachine-1.2.6
Parsing documentation for thin-1.5.1
Installing ri documentation for thin-1.5.1
Parsing documentation for redis-stat-0.4.14
Installing ri documentation for redis-stat-0.4.14
Done installing documentation for ansi256, redis, unicode-display_width, tabularize, insensitive_hash, parallelize, si, tilt, rack, rack-protection, sinatra, json, option_initializer, lps, multi_json, multipart-post, faraday, elasticsearch-transport, elasticsearch-api, elasticsearch, daemons, eventmachine, thin, redis-stat after 22 seconds
24 gems installed
5.1,使用redis-stat 命令行形式
[root@localhost ~]# redis-stat 127.0.0.1:6379
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/patch.rb:5: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/patch.rb:9: warning: constant ::Bignum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/option_initializer-1.5.1/lib/option_initializer.rb:154: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/option_initializer-1.5.1/lib/option_initializer.rb:198: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/redis-3.0.7/lib/redis/client.rb:386: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/module.rb:4: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/module.rb:21: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/module.rb:10: warning: constant ::Fixnum is deprecated
┌────────────────────────┬────────────────┐
│ │ 127.0.0.1:6379 │
├────────────────────────┼────────────────┤
│ redis_version │ 3.2.9 │
│ redis_mode │ standalone │
│ process_id │ 24230 │
│ uptime_in_seconds │ 71039 │
│ uptime_in_days │ 0 │
│ role │ master │
│ connected_slaves │ 0 │
│ aof_enabled │ 0 │
│ rdb_bgsave_in_progress │ 0 │
│ rdb_last_save_time │ 1525847100 │
└────────────────────────┴────────────────┘
┌────────┬──┬──┬──┬───┬─────┬──────┬────┬─────┬─────┬─────┬──────┬─────┬─────┬─────┐
time us sy cl bcl mem rss keys cmd/s exp/s evt/s hit%/s hit/s mis/s aofcs
├────────┼──┼──┼──┼───┼─────┼──────┼────┼─────┼─────┼─────┼──────┼─────┼─────┼─────┤
10:08:59 - - 1 0 803kB 7.33MB 0 - - - - - - 0B
10:09:01 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:03 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:05 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:07 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:09 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:11 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:13 0 1 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:15 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:17 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:19 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:21 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
10:09:23 0 0 1 0 803kB 7.33MB 0 0.50 0 0 - 0 0 0B
└────────┴──┴──┴──┴───┴─────┴──────┴────┴─────┴─────┴─────┴──────┴─────┴─────┴─────┘
5.2,使用redis-stat webserver形式
[root@localhost ~]# redis-stat 127.0.0.1:6379 --server=6666 --daemon #端口自定义
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/sinatra-1.3.6/lib/sinatra/base.rb:1070: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/patch.rb:5: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/si-0.1.4/lib/si/patch.rb:9: warning: constant ::Bignum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/option_initializer-1.5.1/lib/option_initializer.rb:154: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/option_initializer-1.5.1/lib/option_initializer.rb:198: warning: constant ::Fixnum is deprecated
/usr/local/rvm/gems/ruby-2.4.1/gems/redis-3.0.7/lib/redis/client.rb:386: warning: constant ::Fixnum is deprecated
5.3,打开http://服务器ip地址:8000 访问
集群也是一样的
redis-stat 192.168.16.186:7000 192.168.16.186:7001 192.168.16.186:7002 192.168.16.186:7003 192.168.16.186:7004 192.168.16.186:7005 --server=8080 5 --daemon
相关文章:Redis 一站式管理平台工具,支持集群创建、管理、监控、报警
本文最后记录时间 2024-03-31
文章链接地址:https://me.jinchuang.org/archives/233.html
本站文章除注明[转载|引用|来源],均为本站原创内容,转载前请注明出处
文章链接地址:https://me.jinchuang.org/archives/233.html
本站文章除注明[转载|引用|来源],均为本站原创内容,转载前请注明出处