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,但不知道为啥还在跑。

相关推荐
.Shu.5 小时前
Redis Reactor 模型详解【基本架构、事件循环机制、结合源码详细追踪读写请求从客户端连接到命令执行的完整流程】
数据库·redis·架构
卡拉叽里呱啦5 小时前
缓存-变更事件捕捉、更新策略、本地缓存和热key问题
分布式·后端·缓存
degree5209 小时前
全平台轻量浏览器推荐|支持Win/macOS/Linux,极速加载+隐私保护+扩展插件,告别广告与数据追踪!
windows·macos·电脑
lssjzmn13 小时前
🚀如何基于Redis的ZSet数据结构设计一个通用的,简单的,可靠的延迟消息队列,以RedisTemplate为例
redis
jakeswang14 小时前
应用缓存不止是Redis!——亿级流量系统架构设计系列
redis·分布式·后端·缓存
.Shu.16 小时前
Redis zset 渐进式rehash 实现原理、触发条件、执行流程以及数据一致性保障机制【分步源码解析】
数据库·redis·缓存
君不见,青丝成雪16 小时前
大数据技术栈 —— Redis与Kafka
数据库·redis·kafka
悟能不能悟16 小时前
排查Redis数据倾斜引发的性能瓶颈
java·数据库·redis
切糕师学AI16 小时前
.net core web程序如何设置redis预热?
redis·.netcore
冯浩(grow up)17 小时前
macos 安装nodepad++ (教程+安装包+报错后的解决方法)
macos