在Mac上安装redis

166 阅读1分钟

一、安装

brew install redis

$ brew install redis
==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/redis-6.2.5.big_sur.bottle.tar.gz
######################################################################## 100.0%
==> Pouring redis-6.2.5.big_sur.bottle.tar.gz
==> Caveats
To start redis:
  brew services start redis
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf
==> Summary
🍺  /usr/local/Cellar/redis/6.2.5: 14 files, 2.0MB

一、命令

1、启动服务

brew services start redis

2、关闭服务

brew services stop redis

3、重启服务

brew services restart redis

4、卸载

brew uninstall redis rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

5、使用配置文件启动

redis-server /usr/local/etc/redis.conf

6、停止服务

redis-cli shutdown

7、登录服务

redis-cli