安裝命令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