## 通过brew搜索redis
brew search redis
Ac-MacBook-Pro:vhost steven$ brew search redis
==> Formulae
hiredis redis@3.2 homebrew/linuxbrew-core/redis-leveldb
redis redis@4.0 homebrew/linuxbrew-core/redis@3.2
redis-leveldb homebrew/linuxbrew-core/redis homebrew/linuxbrew-core/redis@4.0
## 安装redis@3.2
brew install redis@3.2
## 安装完成的提示
redis@3.2 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have redis@3.2 first in your PATH run:
echo 'export PATH="/usr/local/opt/redis@3.2/bin:$PATH"' >> ~/.bash_profile
To have launchd start redis@3.2 now and restart at login:
brew services start redis@3.2
Or, if you don't want/need a background service you can just run:
/usr/local/opt/redis@3.2/bin/redis-server /usr/local/etc/redis.conf
##设置环境变量
echo 'export PATH="/usr/local/opt/redis@3.2/bin:$PATH"' >> ~/.bash_profile
##使设置生效
source ~/.bash_profile
##redis.conf的daemonize为yes,以守护进程的方式启动
vi /usr/local/ect/redis.conf
## 启动redis服务
brew services start redis@3.2
## 停止redis服务
brew services stop redis@3.2
## 杀写进程
sudo pkill redis-server