09安装运行redis-trib.rb所需的环境

来源:互联网 发布:淘宝店铺二楼怎么开通 编辑:程序博客网 时间:2024/05/16 02:05

        运行redis-trib.rb脚本配置Redis的cluster,需要安装ruby环境,这里采用源码安装:

 

1:下载源码包:

https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz

 

2:解压安装:

tar xzvf ruby-2.2.3.tar.gz -C /root/rediscd /root/redis/ruby-2.2.3/./configure makemake install

3:安装Ruby之后,因redis-trib.rb依赖于gem包redis,因此需要执行命令:gem  install redis,报错:

ERROR:  Loading command: install (LoadError)        cannot load such file -- zlibERROR:  While executing gem ... (NoMethodError)    undefined method `invoke_with_build_args' for nil:NilClass

解决方法:

apt-get install zlib1g-devcd /root/redis/ruby-2.2.3/ext/zlibruby ./extconf.rbmakemake install

4:再次执行命令gem  install  redis,再次报错:

ERROR:  While executing gem ... (Gem::Exception)    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

解决方法:

apt-get install libssl-devcd /root/redis/ruby-2.2.3/ext/opensslruby ./extconf.rbln -s /root/redis/ruby-2.2.3/include /makemake install

5:再次执行命令gem  install  redis,竟然还是报错,错误信息是:

Errno::ECONNRESET: Connection reset by peer

查了一下原因,竟然是伟大的墙做的贡献(https://ruby.taobao.org/),解决办法如下:

#gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/https://ruby.taobao.org/ added to sourceshttps://rubygems.org/ removed from sources#gem sources -l*** CURRENT SOURCES ***https://ruby.taobao.org/

6:再次执行命令gem  install  redis,终于成功,此时,就可以运行redis-trib.rb脚本了。

1 0