在Mac上安装Redis
安装
这是关于安装redis的笔记,因为我需要验证一个叫iodocs的工具。我使用homebrew来安装。
$ brew install redis
==> Downloading https://homebrew.bintray.com/bottles/redis-3.0.7.el_capitan.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring redis-3.0.7.el_capitan.bottle.1.tar.gz
==> Caveats
To have launchd start redis at login:
mkdir -p ~/Library/LaunchAgents
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.7: 9 files, 876.3K
动作确认
$ redis-server -v
Redis server v=3.0.7 sha=00000000:0 malloc=libc bits=64 build=aa27a151289c9b98
开始、停止等
- 起動
$ redis-server
- クライアントツール起動
$ redis-cli
127.0.0.1:6379>
- 停止
在Redis-cli启动期间
127.0.0.1:6379> shutdown
你可以直接执行以下命令。
$ redis-cli shutdown
数据的注册
$ redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"