執行redis命令redis-trib.rb查看集羣信息報錯cannot load such file -- redis (LoadError)

問題描述node

  在執行redis-trib.rb命令查看集羣狀態的時候,報錯:redis

[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)

 問題解決ruby

1.從錯誤來看是少了redis的組件服務器

2.下載redis組件app

下載地址:https://rubygems.org/downloads/redis-4.1.2.gemoop

3.上傳至服務器,並安裝【gem組件的離線安裝】ui

[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

 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集羣的認證密碼spa

5.進入ruby安裝路徑,找到redis的client.rb文件code

[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.

 命令執行成功,問題解決。

 

文檔建立時間:2019年8月2日11:25:25

相關文章
相關標籤/搜索