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   
相关推荐
zzqssliu1 分钟前
Taocarts接口限流实操:基于Redis实现API防刷与流量管控
数据库·redis·缓存
leeyi2 分钟前
流式管道:Pipe、StreamReader、背压控制
agent·ai编程·领域驱动设计
佛系豪豪吖5 分钟前
AtomCode 部署流程与使用经验
笔记·chatgpt·github·ai编程·gitcode
an3174210 分钟前
使用 LangGraph + DeepSeek 构建 AI 面试官:状态图设计与实践
前端·ai编程
啦啦啦啦啦zzzz22 分钟前
redis的持久化操作和主从复制与集群的关系及其应用
数据库·redis
夜尽天明_31 分钟前
告别 AI 乱写代码!一键生成项目“AI 说明书”,让 Cursor 和 Claude 乖乖守规矩
ai编程
IT策士37 分钟前
Redis 从入门到精通:分片之道 —— Redis Cluster
数据库·redis·缓存
win4r44 分钟前
Claude Fable 5 来了:这不是 Opus 的小升级,而是 Anthropic 给 Agent 时代递出的新牌
ai编程·claude·vibecoding
一杯奶茶¥1 小时前
苹果系统可引导镜像 macOS 原版可引导镜像
macos
小明的IT世界1 小时前
编程智能体的上下文工程
人工智能·ai编程