问题描述:
在执行redis-trib.rb命令查看集群状态的时候,报错:
[aiprd@hadoop1 ~]$ redis-trib.rb check 192.168.30.10:7000 Traceback (most recent call last): 2: from /home/aiprd/softwares/redis-3.2.5/src/redis-trib.rb:25:in `<main>' 1: from /home/aiprd/app/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' /home/aiprd/app/ruby-2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- redis (LoadError)
问题解决:
1.从错误来看是少了redis的组件
2.下载redis组件
下载地址:https://rubygems.org/downloads/redis-4.1.2.gem
3.上传至服务器,并安装【gem组件的离线安装】
[aiprd@hadoop1 softwares]$ gem install -l redis-4.1.2.gem Successfully installed redis-4.1.2 Parsing documentation for redis-4.1.2 Installing ri documentation for redis-4.1.2 Done installing documentation for redis after 0 seconds 1 gem installed
因为我装的redis是3版本的,所以下载redis组件应该也是3版本的
访问以下地址下载:http://rubygems.org/downloads/redis-3.3.5.gem
4.再次执行查看集群信息的命令
[aiprd@hadoop1 softwares]$ redis-trib.rb check 192.168.30.10:7000 [ERR] Sorry, can't connect to node 192.168.30.10:7000
报错,无法连接上集群节点,由于redis集群开启了认证,因此需要在redis组件的客户端程序中配置redis集群的认证密码
5.进入ruby安装路径,找到redis的client.rb文件
[aiprd@hadoop1 ~]$ cd /home/aiprd/app/ruby/lib/ruby/gems/2.6.0/gems/redis-4.1.2/lib/redis #/home/aiprd/app/ruby是ruby的安装路径,即--prefix指定的路径
[aiprd@hadoop1 redis]$ ls -l client.rb
-rw-r--r-- 1 aiprd aiprd 16407 Aug 2 11:06 client.rb
6.修改该文件,增加密码如下:
:password => "3GESWjNba9@pMDG",
7.再次执行查看集群状态信息的命令
[aiprd@hadoop1 ~]$ redis-trib.rb check 192.168.30.10:7000 >>> Performing Cluster Check (using node 192.168.30.10:7000) M: 2c8bb60808a0b2bcb155eb45759b8c989cb409f3 192.168.30.10:7000 slots:0-5460 (5461 slots) master 1 additional replica(s) M: 4161a6852df45ee50a065e5e275a24cb1b77f1c1 192.168.30.10:7001 slots:5461-10922 (5462 slots) master 1 additional replica(s) M: b7fdb4a783aa829818eb804c0cc04161ece5e845 192.168.30.10:7002 slots:10923-16383 (5461 slots) master 1 additional replica(s) S: e6b0a64e05e5f3e8dc4b369967090f78fe3c87dc 192.168.30.11:7005 slots: (0 slots) slave replicates b7fdb4a783aa829818eb804c0cc04161ece5e845 S: 37168bd4232c2d1f1f9a22bd88f221e4f15bf4d9 192.168.30.11:7003 slots: (0 slots) slave replicates 4161a6852df45ee50a065e5e275a24cb1b77f1c1 S: cab31dd3554524187ffb4a2758af91f72c8238ac 192.168.30.11:7004 slots: (0 slots) slave replicates 2c8bb60808a0b2bcb155eb45759b8c989cb409f3 [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
命令执行成功,问题解决。
转载:https://blog.csdn.net/HeyShHeyou/article/details/109549143