当前位置:   article > 正文

docker-compose部署redis报错 “ERR Client sent AUTH, but no password is set”_docker (error) err client sent auth, but no passwo

docker (error) err client sent auth, but no password is set

(1)redis报错“ERR Client sent AUTH, but no password is set”

采用docker-compose部署redis,业务服务报错连接redis错误:“ERR Client sent AUTH, but no password is set”

原因:redis服务器没有设置密码,但客户端向其发送了AUTH(authentication,身份验证)请求携带着密码,导致报错。既然是没有设置密码导致的报错,那我们就把Redis服务器给设置上密码就好了。

其实我在部署redis的时候写了配置文件redis.conf,里面配置了密码(requirepass 123456 ),但是由于没在docker-compose配置使用自定义配置,所以redis.conf没生效,需要使我们自定义的配置文件生效。

(2)docker-compose安装redis以配置文件方式启动

  1. version: '2.0'
  2. services:
  3. redis:
  4. image: redis:5.0.3
  5. restart: always
  6. volumes:
  7. - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
  8. - ./redis/data:/data:rw
  9. - ./redis/logs:/logs
  10. command:
  11. # 以配置文件的方式启动 redis.conf
  12. redis-server /usr/local/etc/redis/redis.conf
  13. ports:
  14. - 6379:6379

redis.conf配置:

  1. bind 0.0.0.0
  2. protected-mode no
  3. port 6379
  4. timeout 0
  5. save 900 1 # 900s内至少一次写操作则执行bgsave进行RDB持久化
  6. save 300 10
  7. save 60 10000
  8. rdbcompression yes
  9. dbfilename dump.rdb
  10. # dir data
  11. # 开启数据持久化[aof]
  12. appendonly yes
  13. appendfsync everysec
  14. # 开启密码验证
  15. requirepass 123456

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/835328
推荐阅读
相关标签
  

闽ICP备14008679号