redis 连接错误: Could not connect to Redis at 127.0.0.1:6379: Connection refused

前言

  • docker 安装的 redis 访问出错

错误信息

Could not connect to Redis at 127.0.0.1:6379: Connection refused

错误原因

127.0.0.1 的端口 6379 不是 redis 服务。
可能的原因:

  1. redis 未启动
  2. redis 监听的端口不是 6379
  3. redis 绑定的 IP 不是 127.0.0.1

我是第 3 种情况。

我在redis配置文件中这样写的:

bind 127.0.0.1 ::1
bind 172.18.0.2

这样写的目的是希望 redis 能够绑定到 127.0.0.1 ::1 172.18.0.2 这三个ip上,但,redis 仅绑定到 172.18.0.2 。

改进为:

bind 127.0.0.1 ::1 172.18.0.2

参考

https://blog.csdn.net/qaz18201142158/article/details/107260181

猜你喜欢

转载自blog.csdn.net/sayyy/article/details/131471386