redis-stat 离线安装

 

 

1.redis-stat介绍

    一个用ruby写成的监控redis的程序,基于info命令获取信息,不会像基于MONITOR命令的监控工具一样,对Redis本身有性能上的影响。

    github项目地址:https://github.com/junegunn/redis-stat

 

2.redis-stat在线安装(官网推荐方式,服务器需要可以连接外网)

    2.1 在官网下载redis-stat,下载截图如下:


redis-stat 离线安装_第1张图片
        下载后得到redis-stat-master.zip,下载完后解压如下:

cd /opt
wget https://github.com/junegunn/redis-stat/archive/master.zip
unzip redis-stat-master.zip -d redis-stat-0.4.13
cd redis-stat-0.4.13
ls
bin lib Rakefile redis-stat.gemspec test Gemfile LICENSE README.md screenshots

 

    2.2 redis-stat安装(机器必须联网,不然无法正常安装)

    github项目(https://github.com/junegunn/redis-stat)介绍的安装方式如下:

gem install redis-stat

    该方式首先需要你已经具备ruby和rubygems以及redis环境,这些环境的在linux下的检测如下:

#检测ruby环境
ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

#检测rubygems
3RubyGems(简称 gems)是一个用于对 Ruby组件进行打包的 Ruby 打包系统。
#它提供一个分发 Ruby 程序和库的标准格式,还提供一个管理程序包安装的工具。
#Ruby1.9.2之后版本版本默认自带RubyGems,如果低于这个版本的话,需要自行安装RubyGems,
#参照这里安装http://storysky.blog.51cto.com/628458/1155353/
#因为我是ruby2.3.1所以不需要安装此组件,已经自带了
#检查RubyGems是否安装好的方法如下:
gem -v
2.5.1

 

3.redis-stat离线安装

    3.1 在官网下载redis-stat,下载截图如下:

         参见上面2.1

 

    3.2 离线安装redis-stat

         redis-stat的核心是需要在安装了ruby、rubygems以及redis后,只要成功安装redis-stat-0.4.13.gem就可以了,而安装redis-stat-0.4.13.gem的前提是需要安装redis-stat-0.4.13.gem相关的依赖,这些依赖都可以在https://rubygems.org/一一找到,https://rubygems.org/网站截图如下:

redis-stat 离线安装_第2张图片
         在上面网站,你需要去下载redis-stat-0.4.13.gem以及其相关依赖的gem文件,这里我下载的相关gem如下:

ansi256-0.2.5.gem
daemons-1.1.9.gem
elasticsearch-1.0.0.gem
elasticsearch-api-1.0.0.gem
elasticsearch-transport-1.0.0.gem
eventmachine-1.2.0.1.gem
faraday-0.9.2.gem
insensitive_hash-0.3.0.gem
lps-0.2.0.gem
multipart-post-1.2.0.gem
multi_json-1.12.1.gem
openssl-0.2.0.gem
option_initializer-1.5.0.gem
parallelize-0.4.0.gem
rack-1.3.6.gem
rack-protection-1.2.0.gem
rb-readline-0.5.3.gem
redis-3.0.7.gem
redis-3.2.1.gem
redis-stat-0.4.13.gem
si-0.1.4.gem
sinatra-1.3.3.gem
tabularize-0.2.9.gem
thin-1.5.0.gem
tilt-1.3.3.gem
unicode-display_width-0.1.1.gem

         下载完后,依次安装顺序如下:

gem install --local daemons-1.1.9.gem
gem install --local rack-1.3.6.gem
gem install --local eventmachine-1.2.0.1.gem
gem install --local thin-1.5.0.gem

gem install --local multi_json-1.12.1.gem
gem install --local faraday-0.9.2.gem
gem install --local elasticsearch-api-1.0.0.gem
gem install --local elasticsearch-transport-1.0.0.gem
gem install --local elasticsearch-1.0.0.gem

gem install --local multipart-post-1.2.0.gem
gem install --local option_initializer-1.5.0.gem
gem install --local lps-0.2.0.gem

gem install --local tilt-1.3.3.gem
gem install --local rack-protection-1.2.0.gem
gem install --local sinatra-1.3.3.gem

gem install --local si-0.1.4.gem

gem install --local parallelize-0.4.0.gem

gem install --local insensitive_hash-0.3.0.gem

gem install --local unicode-display_width-0.1.1.gem
gem install --local tabularize-0.2.9.gem

gem install --local redis-3.0.7.gem

gem install --local ansi256-0.2.5.gem

gem install --local rb-readline-0.5.3.gem
gem install --local redis-stat-0.4.13.gem

        上面安装完成后基本就可以去检测redis-stat是否可用了,检测方法是:

cd /opt/redis-stat-0.4.13/bin
./redis-stat -help

          遇到错误的话别紧张,一般还是缺少相关gem,只需要在https://rubygems.org下载相应gem本地化安装就行,例如如下错误信息:

/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- readline (LoadError)
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/gems/2.3.0/gems/redis-stat-0.4.13/lib/redis-stat.rb:17:in `<top (required)>'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from ./redis-stat:4:in `<main>'

         解决办法是,去https://rubygems.org下载rb-readline-0.5.3.gem,然后通过gem install --local rb-readline-0.5.3.gem进行安装就能解决,一切安装就绪后,redis-stat能用的正确提示如下:

cd /opt/redis-stat-0.4.13/bin
./redis-stat -help

usage: redis-stat [HOST[:PORT] ...] [INTERVAL [COUNT]]

-a, --auth=PASSWORD Password
-v, --verbose Show more info
--style=STYLE Output style: unicode|ascii
--no-color Suppress ANSI color codes
--csv[=CSV_FILE] Print or save the result in CSV
--es=ELASTICSEARCH_URL Send results to ElasticSearch: [http://]HOST[:PORT][/INDEX]

--server[=PORT] Launch redis-stat web server (default port: 63790)
--daemon Daemonize redis-stat. Must be used with --server option.

--version Show version
--help Show this message

 

4.redis-stat使用

   参见官网:https://github.com/junegunn/redis-stat

   参见:http://www.ohcoder.com/blog/2015/02/15/redis-stat/

 

  我的后台启动方式如下:

cd /opt/redis-stat-0.4.13/bin
./redis-stat 192.168.173.23:6379 --server --daemon

 浏览器中访问redis-stat地址如下:

 
redis-stat 离线安装_第3张图片
 

你可能感兴趣的:(安装,Redis-stat,离线)