安装命令redis
brew install redis
安装完成后的提示信息vim
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服务器不容许远程访问,只容许本机访问。)code
#bind 127.0.0.1
重启Redis服务器,即可远程访问(电脑安装了oh my zsh,kill redis,按tab,会自动替换成对应的pid)server
kill redis redis-service
ps:在redis3.2以后,redis增长了protected-mode,在这个模式下,即便注释掉了bind 127.0.0.1,再访问redisd时候仍是报错,须要把protected-mode yes改成protected-mode nohomebrew