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