redis-stat 离线安装 博客分类: 缓存redis redis-stat离线安装监控
redis 学习问题总结 |
http://aperise.iteye.com/blog/2310639 |
ehcache memcached redis 缓存技术总结 |
http://aperise.iteye.com/blog/2296219 |
redis-stat 离线安装 |
http://aperise.iteye.com/blog/2310254 |
redis cluster 非ruby方式启动 |
http://aperise.iteye.com/blog/2310254 |
redis-sentinel安装部署 |
http://aperise.iteye.com/blog/2342693 |
spring-data-redis使用 |
http://aperise.iteye.com/blog/2342615 |
redis客户端redisson实战 |
http://blog.csdn.net/zilong_zilong/article/details/78252037 |
redisson-2.10.4源代码分析 |
http://blog.csdn.net/zilong_zilong/article/details/78609423 |
tcmalloc jemalloc libc选择 |
http://blog.csdn.net/u010994304/article/details/49906819 |
1.redis-stat介绍
一个用ruby写成的监控redis的程序,基于info命令获取信息,不会像基于MONITOR命令的监控工具一样,对Redis本身有性能上的影响。
github项目地址:https://github.com/junegunn/redis-stat
必要的linux库安装
yum -y install zlib-devel openssl-devel cmake build-essential autoconf automake libtool zlib1g-dev pkg-config libssl-dev
2.redis-stat在线安装(官网推荐方式,服务器需要可以连接外网)
2.1 在官网下载redis-stat,下载截图如下:
下载后得到redis-stat-master.zip,下载完后解压如下:
cd /opt wget https://github.com/junegunn/redis-stat/archive/redis-stat-master.zip unzip redis-stat-master.zip -d redis-stat-0.4.14
2.2 redis-stat安装(机器必须联网,不然无法正常安装)
(1)必要的linux库安装
yum -y install zlib-devel openssl-devel cmake build-essential autoconf automake libtool zlib1g-dev pkg-config libssl-dev
(2)ruby安装
cd /opt wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz tar -zxvf ruby-2.3.1.tar.gz cd /opt/ruby-2.3.1 ./configure make make install #检测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)ruby的扩展库zlib安装
cd /opt/ruby-2.3.1/ext/zlib ruby ./extconf.rb make make install
(4)ruby的扩展库openssl安装
cd /opt/ruby-2.3.1/ext/openssl ruby ./extconf.rb #如果遇到报错make: *** No rule to make target `/include/ruby.h', needed by `ossl_ssl_session.o'. Stop. #在文件/opt/ruby-2.3.1/ext/openssl/Makefile里添加如下变量top_srcdir,值为ruby源代码的根路径/opt/ruby-2.3.1 #top_srcdir=/opt/ruby-2.3.1 make make install(5)redis-stat在线安装
3.redis-stat离线安装
3.1 在官网下载redis-stat,下载截图如下:
cd /opt wget https://github.com/junegunn/redis-stat/archive/redis-stat-master.zip unzip redis-stat-master.zip -d redis-stat-0.4.14
3.2 离线安装redis-stat
redis-stat的核心是需要在安装了ruby、rubygems以及redis后,只要成功安装redis-stat-0.4.14.gem就可以了,而安装redis-stat-0.4.14.gem的前提是需要安装redis-stat-0.4.14.gem相关的依赖,这些依赖都可以在https://rubygems.org/一一找到,https://rubygems.org/网站截图如下:
(1)必要的linux库安装
yum -y install zlib-devel openssl-devel cmake build-essential autoconf automake libtool zlib1g-dev pkg-config libssl-dev(2)ruby安装
cd /opt wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz tar -zxvf ruby-2.3.1.tar.gz cd /opt/ruby-2.3.1 ./configure make make install #检测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)ruby的扩展库zlib安装
cd /opt/ruby-2.3.1/ext/zlib ruby ./extconf.rb make make install(4)ruby的扩展库openssl安装
cd /opt/ruby-2.3.1/ext/openssl ruby ./extconf.rb #如果遇到报错make: *** No rule to make target `/include/ruby.h', needed by `ossl_ssl_session.o'. Stop. #在文件/opt/ruby-2.3.1/ext/openssl/Makefile里添加如下变量top_srcdir,值为ruby源代码的根路径/opt/ruby-2.3.1 #top_srcdir=/opt/ruby-2.3.1 make make install(5)redis-stat离线安装
在https://rubygems.org/下载redis-stat-0.4.14.gem以及其相关依赖的gem文件,这里我下载的相关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.14.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.14.gem
安装完成后基本就可以去检测redis-stat是否可用了,检测方法是:
cd /opt wget https://github.com/junegunn/redis-stat/archive/redis-stat-master.zip unzip redis-stat-master.zip -d redis-stat-0.4.14 cd /opt/redis-stat-0.4.14/bin ./redis-stat -help #正确显示帮助信息就代表安装成功
遇到错误的话别紧张,一般还是缺少相关gem,只需要在https://rubygems.org下载相应gem本地化安装就行,例如如下错误信息:
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.14/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能用的正确提示如下:
./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/
后台启动方式如下:
./redis-stat 192.168.173.23:6379 192.168.173.23:6380 192.168.173.23:6381 192.168.173.24:6379 192.168.173.24:6380 192.168.173.24:6381 --server --daemon
浏览器中访问redis-stat地址如下: