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

安装命令

复制代码
brew install redis

查看安装位置命令

复制代码
brew list redis  #查看redis安装的位置

% brew list redis
/usr/local/Cellar/redis/6.2.5/.bottle/etc/ (2 files)
/usr/local/Cellar/redis/6.2.5/bin/redis-benchmark
/usr/local/Cellar/redis/6.2.5/bin/redis-check-aof
/usr/local/Cellar/redis/6.2.5/bin/redis-check-rdb
/usr/local/Cellar/redis/6.2.5/bin/redis-cli
/usr/local/Cellar/redis/6.2.5/bin/redis-sentinel
/usr/local/Cellar/redis/6.2.5/bin/redis-server
/usr/local/Cellar/redis/6.2.5/homebrew.mxcl.redis.plist
/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/

% open .
% vim /usr/local/etc/redis.conf

对应内容:

复制代码
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>homebrew.mxcl.redis</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/opt/redis/bin/redis-server</string>
		<string>/usr/local/etc/redis.conf</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/usr/local/var/log/redis.log</string>
	<key>StandardOutPath</key>
	<string>/usr/local/var/log/redis.log</string>
	<key>WorkingDirectory</key>
	<string>/usr/local/var</string>
</dict>
</plist>

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

修改配置文件

遇到下面连接问题:

原因:

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

解决办法

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

重启redis命令

复制代码
brew services restart redis

尝试celery连接成功

关闭Redis

复制代码
brew services stop redis   
相关推荐
kyriewen2 分钟前
AI 改祖传模块后,代码评审总绕不开两个问题
前端·程序员·ai编程
颜淡慕潇2 小时前
Loop已死,Graph永生?深度看懂:2026年AI工程的真正范式跃迁
ai编程
两斤牛肉一壶酒3 小时前
第一个纯AI手搓的脚本程序终于出炉了:##批量导入知识库##
ai编程
wechatbot8883 小时前
SpringBoot Vue 企业微信多账号托管|扫码登录 代理 IP 消息回调
大数据·后端·微信·企业微信·ai编程
星核0penstarry3 小时前
B站AI大赛3万份投稿背后的真相:门槛下移后,新的壁垒是什么?
人工智能·个人开发·ai编程·自动写代码
LiCoMi4 小时前
AI Agent 开发学习路线-第五课
agent·ai编程
用户5619035069335 小时前
模型输出被截断、报 context length 超限怎么解决?
ai编程
全栈弄潮儿²⁰²⁴5 小时前
AI Agent 开发实战(7):如何接入搜索和数据库工具?
数据库·人工智能·ai·chatgpt·oracle·agent·ai编程
云雀衔光5 小时前
MCP 协议全景:为什么它是 AI 连接工具的「USB-C」
java·开发语言·数据库·人工智能·ai编程
钱栈up5 小时前
Mac端一键部署服务端项目:从流程梳理到踩坑适配的完整实践
macos