redis-cli -h 172.25.58.2 Could not connect to Redis at 172.25.58.2:6379: Connection

问题描述:

在做redis集群时,在master上使用   redis-cli -h 172.25.58.2   远程连接slave2时出现以下报错:

[root@server1 ~]# redis-cli -h 172.25.58.2
Could not connect to Redis at 172.25.58.2:6379: Connection refused

问题分析:

可能一:服务端(也就是slave端)没有启动redis

可能二:通常情况下生产环境下的Redis服务器只设置为仅本机访问(Redis默认也只允许本机访问)

解决方法:

针对可能一:使用 /etc/init.d/redis_6379 restart   启动redis

针对可能二:

[root@server2 ~]# vim /etc/redis/6379.conf

  70 bind 0.0.0.0    #设置为任何设备均可访问

然后重启redis

发布了124 篇原创文章 · 获赞 18 · 访问量 3093

猜你喜欢

转载自blog.csdn.net/weixin_42221657/article/details/103478378