当前位置:   article > 正文

Mac brew安装Redis之后更新配置文件的方法

Mac brew安装Redis之后更新配置文件的方法

安装命令

brew install redis

查看安装位置命令

brew list redis  #查看redis安装的位置
  1. % brew list redis
  2. /usr/local/Cellar/redis/6.2.5/.bottle/etc/ (2 files)
  3. /usr/local/Cellar/redis/6.2.5/bin/redis-benchmark
  4. /usr/local/Cellar/redis/6.2.5/bin/redis-check-aof
  5. /usr/local/Cellar/redis/6.2.5/bin/redis-check-rdb
  6. /usr/local/Cellar/redis/6.2.5/bin/redis-cli
  7. /usr/local/Cellar/redis/6.2.5/bin/redis-sentinel
  8. /usr/local/Cellar/redis/6.2.5/bin/redis-server
  9. /usr/local/Cellar/redis/6.2.5/homebrew.mxcl.redis.plist
  10. /usr/local/Cellar/redis/6.2.5/homebrew.redis.service

对应安装目录是/usr/local/Cellar/redis/6.2.5/

查看配置文件

配置文件位置记录在homebrew.mxcl.redis.plist properties list文件中

cd /usr/local/Cellar/redis/6.2.5/
  1. % open .
  2. % vim /usr/local/etc/redis.conf

对应内容:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4. <dict>
  5. <key>KeepAlive</key>
  6. <true/>
  7. <key>Label</key>
  8. <string>homebrew.mxcl.redis</string>
  9. <key>ProgramArguments</key>
  10. <array>
  11. <string>/usr/local/opt/redis/bin/redis-server</string>
  12. <string>/usr/local/etc/redis.conf</string>
  13. </array>
  14. <key>RunAtLoad</key>
  15. <true/>
  16. <key>StandardErrorPath</key>
  17. <string>/usr/local/var/log/redis.log</string>
  18. <key>StandardOutPath</key>
  19. <string>/usr/local/var/log/redis.log</string>
  20. <key>WorkingDirectory</key>
  21. <string>/usr/local/var</string>
  22. </dict>
  23. </plist>

所以配置文件是/usr/local/etc/redis.conf

修改配置文件

遇到下面连接问题:

原因:

这个错误表明你的应用程序(consumer)试图连接到本地运行的Redis服务器实例,但是连接认证失败了。这通常是因为提供的密码(通常以<password>表示)与Redis服务器配置的密码不匹配。

解决办法

  1. redis的保护模式关闭
  2. # By default protected mode is enabled. You should disable it only if
  3. # you are sure you want clients from other hosts to connect to Redis
  4. # even if no authentication is configured, nor a specific set of interfaces
  5. # are explicitly listed using the "bind" directive.
  6. # 受保护模式, 默认是开启的
  7. # protected-mode yes
  8. protected-mode no

重启redis命令

brew services restart redis

尝试celery连接成功

关闭Redis

brew services stop redis   

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

闽ICP备14008679号