Mac安装Redis并后台运行

4 篇文章 2 订阅

使用brew安装Redis

brew安装教程请参考链接:点击此处快速安装brew

brew install redis

可能会安装失败报错(不报错直接跳过)

Error: The following directories are not writable by your user:
/usr/local/lib

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/lib

And make sure that your user has write permission.
  chmod u+w /usr/local/lib

出错修复,是因为没有权限导致,执行下两句:

sudo chown -R $(whoami) /usr/local/lib
或者
chmod u+w /usr/local/lib

安装成功

执行上述命令后出现以下,则成功安装:

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/redis-6.0.10
######################################################################## 100.0%
==> Pouring redis-6.0.10.mojave.bottle.tar.gz
==> Caveats
To have launchd start redis now and restart at login:
  brew services start redis
Or, if you don't want/need a background service you can just run:
  redis-server /usr/local/etc/redis.conf
==> Summary
/usr/local/Cellar/redis/6.0.10: 13 files, 3.7MB

Mac安装后路径
安装路径

配置redis.conf

配置文件路径:/usr/local/etc/redis.conf
编辑配置文件

vim /usr/local/etc/redis.conf
# 找到 bind 将其注释
#bind 127.0.0.1
# 找到 protected-mode 值改为 no
protected-mode yes 改为 no
 # 设置后台运行
daemonize no 改为 yes

保存使用命令"esc:wq 回车"(冒号不可省略)
后台运行

启动redis

/usr/local/Cellar/redis/6.0.10/bin/redis-server /usr/local/etc/redis.conf &

启动图片
查看redis进程,默认端口号:6379

ps -ef|grep redis

redis进程

有酒就去喝,有爱就去爱,一生那么短,再拘谨几下就真的过去了。

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值