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   
相关推荐
better_liang1 小时前
每日Java面试场景题知识点之-Redisson热门使用场景
java·redis·微服务·分布式锁·redisson·分布式系统
Miki Makimura2 小时前
C++聊天室项目:注册登录接口与 Redis 缓存
c++·redis·缓存
C澒4 小时前
AI 生码:RAG 检索优化实现可评估、可回溯工程化
前端·ai编程
泰白聊AI4 小时前
AI 编程时代的规范驱动开发:OpenSpec 实践指南
服务器·人工智能·驱动开发·ai·aigc·ai编程
wangyang62754 小时前
AI 驱动的跨端迁移实践(上):一套工作流,一端变三端
ai编程
刘~浪地球4 小时前
Redis 从入门到精通(七):集合操作详解
数据库·chrome·redis
YummyJacky5 小时前
Redis在项目中的应用
数据库·redis·缓存
RDCJM5 小时前
nginx 代理 redis
运维·redis·nginx
财经资讯数据_灵砚智能6 小时前
基于全球经济类多源新闻的NLP情感分析与数据可视化(日间)2026年4月5日
大数据·人工智能·python·信息可视化·自然语言处理·ai编程
飞翔的SA6 小时前
MLX‑VLM :Mac本地跑通多模态大模型的开源项目!让图片、音频、视频理解一键上手
人工智能·python·macos·音视频