redis5.0.5版本搭建集群

本文详细介绍了如何在Ubuntu 16.0.4上使用Redis 5.0.5版本构建一个包含三个主节点和三个从节点的集群。关键步骤包括创建六个节点目录,配置各节点的redis.conf文件,启动redis实例,以及通过redis-cli创建集群。在配置过程中注意bind地址和防火墙设置,并提供了在遇到问题时的解决方法。
摘要由CSDN通过智能技术生成

                                     redis5.0.5版本搭建集群

 

安装redis5.0.5版本

将redis5.0.5解压

sudo tar -zxcf redis5.0.5.tar.gz make make install

如果没有make命令:

sudo apt-get install make

 

安装ruby

sudo apt-get install ruby

 

ubuntu16.0.4创建redis集群(三主三从)

 

一..创建六个redis节点目录

sudo mkdir 7000 7001 7002 7003 7004 7005

 

 

二.各自创建redis.conf配置文件 (端口号需要改成各自实例的端口号)

port 7000
#用于开实例的集群模式
cluster-enabled yes  
#设定了保存节点配置文件的路径
cluster-config-file nodes.conf 
cluster-node-timeout 5000
appendonly yes
bind 192.168.44.128
protected-mode no

坑1:bind 地址写虚拟机的真实ip地址,通过ifconfig查ip地址 (写127.0.0.1项目连接会报连接被拒绝)

坑2:由于Linux上的redis处于安全保护模式,这就让你无法从虚拟机外部去轻松建立连接,这里就有两种解决方法,一种是在redis.conf中设置保护模式为no,要么设置redis密码

原因:配置文件少了第8,9行的配置

如下图:

报错关键字:protected mode is enabled no bind address was specified , no authentication password is requested to clients

020-07-29 15:14:36.960 ERROR 27312 --- [isson-netty-2-3] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x770bbad2, L:/192.168.44.1:55318 - R:/192.168.44.128:7002]
2020-07-29 15:14:36.960 ERROR 27312 --- [isson-netty-2-4] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x04f2e3ec, L:/192.168.44.1:55319 - R:/192.168.44.128:7001]
2020-07-29 15:14:36.960 ERROR 27312 --- [isson-netty-2-5] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x5ff2054a, L:/192.168.44.1:55320 - R:/192.168.44.128:7005]
2020-07-29 15:14:36.961 ERROR 27312 --- [isson-netty-2-6] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0xee00c278, L:/192.168.44.1:55321 - R:/192.168.44.128:7000]
2020-07-29 15:14:36.961 ERROR 27312 --- [isson-netty-2-7] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x251a1d0f, L:/192.168.44.1:55322 - R:/192.168.44.128:7003]
2020-07-29 15:14:37.058 ERROR 27312 --- [isson-netty-2-9] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable p
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值