搜索:
bash
brew search redis
安装Redis:
brew install redis
关于启动命令的提示:
bash
To 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:
/opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
启动命令1: 默认启动
bash
brew services start redis
启动命令2: 指定配置文件
bash
/opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
通过 redis-server
启动:
通过命令行连接redis:
bash
# 远程服务连接
redis-cli -h IP -p 6379
# 本机服务连接
redis-cli
关闭redis服务:
bash
redis-cli shutdown
实测关闭不了.
查看 brew services
的相关帮助命令:
bash
brew services -h
尝试使用如下命令关闭:
bash
brew services stop redis
关闭成功.
最后总结常用命令:
bash
# 启动
brew services start redis
# 链接
redis-cli
# 关闭
brew services stop redis