macOS install redis遇到的bug(tar包,homebrew安装,守护进程redis.conf配置)

官网下载tar包再make install

首先是sudo make test的时候一直报

The following tests failed:

*** err: trim on SET with big value in tests/unit/type/string.tcl Expected r memory usage key < 42000 (context: type source line 478

file /usr/local/redis-7.0.12/tests/unit/type/string.tcl cmd {assert

{r memory usage key < 42000}} proc ::test)

解决方法:

因为r set key和Mac m1芯片的内存配置不同,引用掉这段test
https://blog.csdn.net/sun_kingngfyncfh/article/details/130744756
https://github.com/redis/redis/pull/11878/files/859dd6c8e91599d8cf013ff1b7758f308dbfcfc4

这个可以成功make test之后,sudo make 和make install又开始报warning

/bin/sh:1:pkg-config: not found

解决方案:

莫名其妙,但还是试着去安装了python tcl tk的包,useles,但看到有人说出现这个也不影响,之后确实可以make install。

但会一直重复提示Hint: It's a good idea to run 'make test' 😉

解决方案:run make distclean

and again sudo make install

偶尔可以,但还是没有装上,放弃make安装了

brew install

后来看到官网给macos的安装方法:
https://redis.io/docs/getting-started/installation/install-redis-on-mac-os/

很简单的傻瓜式安装😢,想不明白折腾着包安装图啥,谢谢homebrew

配置redis.conf守护进程

homebrew安装完之后,在哪里找conf配置文件呢?

brew list redis

会先找到redis相关文件的位置

安装路径一般在 /usr/local/Cellar/redis/{version}或者/opt/homebrew/Cellar/redis/7.0.12/bin/里有redis-server

cd /opt/homebrew/Cellar/redis/7.0.12/bin/

open ./

发现没有conf文件,接着打开

cat homebrew.mxcl.redis.plist

发现有

找到啦!

cd /opt/homebrew/etc/

cp redis.conf /opt/homebrew/Cellar/redis/7.0.12/bin/

没有直接修改而是拷贝了以防修改错误,接着修改conf文件变成守护进程

vim redis.conf

daemonizeno改为yes

daemonize yes

默认绑定的是回环地址,默认不能被其他机器访问

bind 0.0.0.0

是否开启保护模式,由yes该为no

protected-mode no
./redis-server redis.conf

运行守护进程

Warning: Could not create server TCP listening socket *:6379: bind: Address already in use 11637:M 03 Aug 2023 09:52:54.996 # Failed listening on port 6379 (TCP), aborting.

跑完守护进程的redis server之后再跑redis-server开始报already used socket

java 复制代码
ps -ef | grep redis

看下后台在跑的端口进程,发现0.0.0.0还有redis server在跑。没有关闭。

kill -9 {进程号}

kill掉就好了

https://blog.csdn.net/qq_43833393/article/details/127889619

解释:

因为前端启动的redis server会在每次terminal或者ctrl c关闭后,就停止,我们采用守护进程就是希望可以后端持续运行,但是./redis-cli shutdown按理说可以直接关闭后段进程不需要kill,但不知道为啥还在跑。

相关推荐
接着奏乐接着舞。7 小时前
【2026】73道Redis 常见面试题与参考答案
数据库·redis·后端·缓存
ApacheSeaTunnel11 小时前
用 Apache SeaTunnel 同步 DynamoDB 到 Redis,一个配置文件就够
redis·开源·seatunnel·数据同步·dynamodb
kingbal13 小时前
MAC:chatgpt登陆报错签名异常
macos·chatgpt
k4m7v2pz13 小时前
macOS 窗口最小化:三种写法的实测对比与可复用脚本
macos·窗口管理·截屏·applescript·bevy·ai自动化
MetaLite14 小时前
SpringBoot防重复提交-加一把Redis锁就够吗
spring boot·redis·后端
Seraphina3614 小时前
记一次实验:利用缓存服务器规范化技术进行网页缓存欺骗
经验分享·笔记·网络安全·缓存
Capricorn198815 小时前
Bug排障实录:Software 3.0 遭遇文献幻觉?知芽 Notebook Skill 底层架构解析
人工智能·笔记·架构·bug·论文笔记
项目管理与代码18 小时前
Bug跟踪管理系统对比:从提报效率、流转体验与数据分析能力三个维度评估
bug·项目管理·bug跟踪
草莓熊Lotso2 天前
【Redis 初阶】Set 类型深度解析:去重集合的运算能力与实战场景
linux·网络·数据库·windows·redis·tcp/ip·缓存
小白勇闯网安圈2 天前
String、Hash、List、Set 四大数据结构与通用命令
redis