Redis配置主从时报错“Could not connect to Redis at 192.168.0.50:6379: Connection refused not connected>”

时间:2022-05-16 12:02:47

配置Redis主从时,修改完从节点配置文件,然后报错

[root@Rich七哥-0-50 redis]# /opt/redis/redis-cli -h 192.168.0.50
Could not connect to Redis at 192.168.0.50:6379: Connection refused
not connected> quit

这是因为需要重新加载配置文件

执行

redis-server /etc/redis.conf 

1430:C 30 Oct 2019 09:46:45.118 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1430:C 30 Oct 2019 09:46:45.118 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=1430, just started
1430:C 30 Oct 2019 09:46:45.118 # Configuration loaded

Redis配置主从时报错“Could not connect to Redis at 192.168.0.50:6379: Connection refused not connected>”

然后从新连接时,恢复正常