Redis创建集群报错`require‘: cannot load such file -- redis (LoadError)

Redis创建集群报错`require': cannot load such file -- redis LoadError

介绍


redis每个节点都启动后,创建集群报错require’: cannot load such file – redis (LoadError)

redis-trib.rb create --replicas 1 192.168.100.10:8001 192.168.100.10:8002 \
192.168.100.11:8001 192.168.100.11:8002 \
192.168.100.12:8001 192.168.100.12:8002 
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in 
`require': cannot load such file -- redis (LoadError)
	from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /data/redis/bin/redis-trib.rb:25:in `<main>'

报错分析


ruby 使用 require 引入依赖
缺少 redis 的相关依赖,需要通过 gem 安装

给ruby环境安装redis依赖包


执行命令

gem install redis

如果没有网的话,执行命令,提前把redis的gem包传到服务器上

[code404@code404.icu ~/redis]$gem install -l redis-3.3.0.gem 
Successfully installed redis-3.3.0
Parsing documentation for redis-3.3.0
Installing ri documentation for redis-3.3.0
1 gem installed

安装成功后重新执行创建指令即可成功。

创建Redis集群


redis-trib.rb create --replicas 1 192.168.100.10:8001 192.168.100.10:8002 \
192.168.100.11:8001 192.168.100.11:8002 \
192.168.100.12:8001 192.168.100.12:8002 
>>> Creating cluster
>>> Performing hash slots allocation on 6 nodes...
Using 3 masters:
192.168.100.10:8001
192.168.100.11:8001
192.168.100.12:8001
Adding replica 192.168.100.11:8002 to 192.168.100.10:8001
Adding replica 192.168.100.11:8002 to 192.168.100.11:8001
Adding replica 192.168.100.10:8002 to 192.168.100.12:8001
M: 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c 192.168.100.10:8001
   slots:0-5460 (5461 slots) master
S: 5a3c23ee70ee1a77aabb33e93b59611aa48790e1 192.168.100.10:8002
   replicates fdc7022e98e9619a9dd4574501f3648627d58c38
M: 71663ec6304e762565cd73512bef7a7e4f764235 192.168.100.11:8001
   slots:5461-10922 (5462 slots) master
S: 0ac27a24f78ff7d3e5b4fff8c97ad4a09700d930 192.168.100.11:8002
   replicates 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c
M: fdc7022e98e9619a9dd4574501f3648627d58c38 192.168.100.12:8001
   slots:10923-16383 (5461 slots) master
S: 4a0a20b6c6c925e582997be447848edeee9e8456 192.168.100.11:8002
   replicates 71663ec6304e762565cd73512bef7a7e4f764235
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join.
>>> Performing Cluster Check (using node 192.168.100.10:8001)
M: 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c 192.168.100.10:8001
   slots:0-5460 (5461 slots) master
   1 additional replica(s)
S: 4a0a20b6c6c925e582997be447848edeee9e8456 192.168.100.11:8002
   slots: (0 slots) slave
   replicates 71663ec6304e762565cd73512bef7a7e4f764235
S: 0ac27a24f78ff7d3e5b4fff8c97ad4a09700d930 192.168.100.11:8002
   slots: (0 slots) slave
   replicates 7ef8d6b70f1e1a02c5936ad67454418ef4487a7c
M: fdc7022e98e9619a9dd4574501f3648627d58c38 192.168.100.12:8001
   slots:10923-16383 (5461 slots) master
   1 additional replica(s)
M: 71663ec6304e762565cd73512bef7a7e4f764235 192.168.100.11:8001
   slots:5461-10922 (5462 slots) master
   1 additional replica(s)
S: 5a3c23ee70ee1a77aabb33e93b59611aa48790e1 192.168.100.10:8002
   slots: (0 slots) slave
   replicates fdc7022e98e9619a9dd4574501f3648627d58c38
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

创建Redis集群完成

CSDN_码404:Redis创建集群报错`require’: cannot load such file – redis (LoadError)
https://www.code404.icu/1497.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值