创建Redis-Cluster集群时遇到的问题/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require’: cannot load such file – redis (LoadError)"
搜索报错得知问题为
redis4.0配置集群,通过yum intall 安装的ruby版本过低,需要升级ruby
解决方案:
升级ruby,
通过recv-keys方式根本无法安装ruby,于是搜索: centos7 升级 ruby
找到另一种解决方案,通过 http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.gz网址下载
遇到新的问题:
ruby-2.3.5.tar.gz下载过慢,需要几个小时以上
通过Internet download manager下载
①安装Ruby
~]# wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.gz
~]# tar zxvf ruby-2.3.5.tar.gz
~]# cd ruby-2.3.5
ruby-2.3.5]# ./configure --prefix=/opt/ruby
ruby-2.3.5]# make && make install
ruby-2.3.5]# ln -s /opt/ruby/bin/ruby /usr/bin/ruby
ruby-2.3.5]# ln -s /opt/ruby/bin/gem /usr/bin/gem
~]#ruby -v //查看一下
②安装rubygem redis依赖
~]# wget http://rubygems.org/downloads/redis-3.3.0.gem
~]# gem install -l redis-3.3.0.gem
如果这步报错,如下:
~]# gem install -l redis-3.3.0.gem
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 -y install zlib-devel
进入ruby源码文件夹,安装ruby自身提供的zlib包
cd ruby-2.3.5/ext/zlib
ruby ./extconf.rb
make
make install
到make这一步时又报错:
No rule to make target '/include/ruby.h', needed by 'zlib.o'. Stop
此步骤在网上卡了好久,网上帖子说在ext/openssl/Makefile 增加 top_srcdir = …/…
加上后不生效,试了好多次,快放弃了
后来在ruby的目录ruby-2.3.5/ext/zlib 敲了ls
看到了Makefile文件,于是在该文件中首行加了句
top_srcdir = ../..
make成功
然后再次执行gem install -l redis-4.0.1.gem,正常通过显示Successfully… 。
随后集群配置成功