redis-cluster安装需要通过gem install redis来安装相关依赖。否则报错。
通过gem install redis执行后会出现两个问题:
1、缺少zlib依赖
问题:
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NoMethodError)
undefined method 'invoke_with_build_args' for nil:NilClass
解决:
通过yum install zlib-devel 安装zlib库
然后集成zlib库到ruby环境
cd /usr/local/ruby-2.2.7/ext/zlib
ruby extconf.rb
重要:ext/openssl/Makefile 增加 top_srcdir = ../..
//这一步如果不修改,make时会爆出另外一个错误
//make:*** No rule to make target '/include/ruby.h', needed by 'zlib.o'. Stop
make && make install
2、缺少openssl库
问题:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
解决:
通过yum install openssl-devel 安装openssl库
然后集成到ruby环境
cd /usr/local/ruby-2.2.7/ext/zlib
ruby extconf.rb
重要:ext/openssl/Makefile 增加 top_srcdir = ../..
//修改Makefile中的$(top_srcdir)为../..
make && make install
再次运行gem install redis,出现下图则表示安装成功