让我们尝试使用brew安装Redis
前提 tí)
家庭酿造已安装
redisインストール
$ brew install redis
==> Downloading https://homebrew.bintray.com/bottles/redis-3.0.5.el_capitan.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/redis-3.0.5.el_capitan.bottle.tar.gz
==> Pouring redis-3.0.5.el_capitan.bottle.tar.gz
==> Caveats
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
==> Summary
? /usr/local/Cellar/redis/3.0.5: 9 files, 892K
$
登录时,将其设定为自动启动。
登录时,设定为自动开启。
登录时,自动启动已注册。
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
立即启动服务器。
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Redis配置文件的位置
# Redis configuration file example.
#
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
...
启动并确认
$ redis-cli
127.0.0.1:6379> set 'a' 111
OK
127.0.0.1:6379> get 'a'
"111"
127.0.0.1:6379> exit
$