安装命令
brew install redis
安装完成后的提示信息
To have launchd start redis at login:
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don’t want/need launchctl, you can just run:
redis-server /usr/local/etc/redis.conf
修改配置文件
vim /usr/local/etc/redis.conf
注释bing(默认情况下,Redis服务器不允许远程访问,只允许本机访问。)
#bind 127.0.0.1
重启Redis服务器,便可远程访问(电脑安装了oh my zsh,kill redis,按tab,会自动替换成对应的pid)
kill redis
redis-service
ps:在redis3.2之后,redis增加了protected-mode,在这个模式下,即使注释掉了bind 127.0.0.1,再访问redisd时候还是报错,需要把protected-mode yes改为protected-mode no