目录:
解决-gem install redis提示版本问题
解决-Ruby版本过低的问题
解决-哈希槽被占用错误问题
解决-集群节点不为空
本文根据笔者亲身搭建Redis集群环境遇到的一些问题,在此把它们整理归纳,问题描述已经解决方法:
1.1 解决-gem install redis提示版本问题
gem install redis此命令无法安装,报错:
[root@hadoop01 redis-4.0.11]# gem install redis
ERROR: Error installing redis:
redis requires Ruby version >= 2.3.0.
[root@hadoop01 redis-4.0.11]#
Redis依赖的Ruby的版本太低,需要2.3.0或以上版本。
查看ruby版本:
[root@hadoop01 redis-4.0.11]# ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
当前ruby版本1.8.7,需要升级到2.3.0或以上版本。具体解决方案详见:1.2解决ruby版本过低的问题
1.2 解决-Ruby版本过低的问题
错误:Ruby与redis版本不兼容造成的错误:

解决方法:
gem list
gem uninstall redis --version 3.0.0
gem install redis
1、yum install curl
2、curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -

3、curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -

4、curl -L https://get.rvm.io | bash -s stable

5、查找rvm的启动文件:find / -name rvm.sh

6、source /etc/profile.d/rvm.sh
7、rvm requirements

8、rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
9、source /usr/local/rvm/scripts/rvm
10、rvm list known

11、rvm install 2.3.8

12、rvm use 2.3.8

13、删除低版本 rvm remove 1.8.7
14、ruby –v

15、gem install redis

参考:https://blog.csdn.net/chengxiadenghuo/article/details/103531480
1.3 解决-哈希槽被占用错误问题
错误:提示哈希槽被占用
/usr/lib/ruby/gems/-2.3.8/gems/redis-4.1.3/lib/redis/client.rb:126:in `call': ERR Slot 5461 is already busy (Redis::CommandError)

解决方法:所有节点,清除上一次的错误残留,重启Cluster节点。
[root@hadoop01 bin]# redis-cli -h 192.168.100.129 -p 7000
192.168.100.129:7000> flushall
OK
192.168.100.129:7000> cluster reset
OK
192.168.100.129:7000>
1.4 解决-集群节点不为空
启动集群时错误提示:
[ERR] Node 192.168.100.129:7000 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
解决方法:
删除所有节点的appendonly.aof、nodes.conf,重新启动服务。
|