安装ruby1.9.3-p0及redmon来监控redis

本文详细介绍了如何在本地环境中安装Ruby、Rails以及Redmon监控工具的过程。包括解决依赖问题、配置代理访问RubyGems等常见难题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先来个前戏: redmon 的监控页面没有任何文字说明,仅仅就其README里面的信息来说,应该是通过ruby on rails来实现的。对于这门语言无任何涉猎的情况开始一下安装之旅。

一、安装Ruby
初始安装直接

$ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
$ tar xzvf ruby-1.9.3-p0.tar.gz
$ cd ruby-1.9.3-p0
$ ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
$ make
$ make install

结果发现问题:
It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.
 
 
从源码安装

$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
$ tar xzvf yaml-0.1.4.tar.gz
$ cd yaml-0.1.4
$ ./configure --prefix=/usr/local
$ make
$ make install

然后再清理 ruby-1.9.3-p0里面的安装文件,重新来一遍,总算ruby安装成功!


二、安装rails
安装好ruby之后发现万里长征才刚刚开始,我汗。。。Gem之类的,折腾半天。记录下来
当前1.9.3版本之后已经默认集成gem进来,但也可以通过下载来运行:

1. wget http://rubyforge.org/frs/download.php/75711/rubygems-1.8.15.tgz
解压后,进入对应目录
ruby setup.rb
之后再gem -v 发现版本号已经是1.8.15

2. gem update --system  看看是否能够更新。

3. 然后安装bundler
  gem install bundler

三、安装redmon
从github上克隆对应的源码下来

git clone https : //github.com/steelThread/redmon.git
cd redmon
bundler install

提示如下错误:

Fetching source index for http://rubygems.org/ Could not reach rubygems repository http://rubygems.org/ Could not find multi_json-1.0.4 in any of the sources


gem install multi_json -V   (带-V的参数可以显示的看到gem去download的过程,很多时候因为被墙而下不下来)
解决方案 可以通过-p的参数来设定 http的代理访问 -p http://114.255.217.10:80 -r --backtrace 指定远程的repo下载安装  

[#16 root@com8-16 redmon]# gem install activesupport -r -V GET http://rubygems.org/latest_specs.4.8.gz 302 Found GET http://production.s3.rubygems.org/latest_specs.4.8.gz connection reset after 1 requests, retrying GET http://production.s3.rubygems.org/latest_specs.4.8.gz connection reset after 1 requests, retrying GET http://rubygems.org/quick/Marshal.4.8/activesupport-3.1.3.gemspec.rz connection reset after 2 requests, retrying GET http://rubygems.org/quick/Marshal.4.8/activesupport-3.1.3.gemspec.rz 302 Found GET http://production.cf.rubygems.org/quick/Marshal.4.8/activesupport-3.1.3.gemspec.rz 200 OK GET http://rubygems.org/specs.4.8.gz 302 Found GET http://production.s3.rubygems.org/specs.4.8.gz

太多302跳转之类的了,国内对外这些技术网站的访问越来越困难,IT民工情何以堪!!

陆续又报出缺少 activesupport等等。

不过经过了半天的时间,总算能够bundle install 成功了

[#16 root@com8-16 redmon]# bundle install Fetching source index for http://rubygems.org/ Using rake (0.9.2.2) Using multi_json (1.0.4) Using activesupport (3.1.3) Installing bson (1.5.2) Installing bson_ext (1.5.2) with native extensions Installing chronic (0.6.6) Installing daemons (1.1.5) Installing delorean (1.2.0) Installing diff-lcs (1.1.3) Installing hiredis (0.3.2) with native extensions Installing em-hiredis (0.1.0) Installing eventmachine (0.12.10) with native extensions Installing haml (3.1.4) Installing i18n (0.6.0) Installing rack (1.4.0) Installing rack-protection (1.2.0) Installing rack-test (0.6.1) Installing redis (2.2.2) Installing tilt (1.3.3) Installing sinatra (1.3.2) Installing thin (1.3.1) with native extensions Using redmon (0.0.1) from source at . Installing rspec-core (2.6.4) Installing rspec-expectations (2.6.0) Installing rspec-mocks (2.6.0) Installing rspec (2.6.0) Installing shoulda (2.11.3) Using bundler (1.0.21) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed

激动人心的时刻终于来了!
ruby sample/app.rb
通过浏览器来访问:
http://localhost:4567
默认是指向本地的6379端口的redis,如果需要查看其他redis的监控情况,请修改 lib/redmon.rb 里面的代码:

DEFAULT_OPTS = { :redis_url => 'redis://127.0.0.1:6379', :namespace => 'redmon', :web_interface => ['0.0.0.0', 4567], :worker => true, :poll_interval => 10


贴两张图吧,有图有真相:
安装ruby1.9.3-p0及redmon来监控redis - johnnychenjun - shadowhunter的博客
 
安装ruby1.9.3-p0及redmon来监控redis - johnnychenjun - shadowhunter的博客
 总体感觉,功能上还不太完善,keys 和 slow log 都“敬请期待” 来着。 
还是期待作者能尽快加入更多的功能进这个dashboard监控。

BY THE  WAY:
  本地 cygwin 来进行安装配置ruby on rails 的方案 请看:
这两篇文章,采用rvm来进行ruby的安装配置:

我本地也做了相应的测试,应该都没有问题:

 bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
来获取RVM 来进行安装。

rvm install 1.9.3

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值