LoginSignup
7
7

More than 5 years have passed since last update.

macにredisをインストール

Posted at

インストール

iodocsというツールを検証するためにredisが必要だったのでインストールしたときのメモ。
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"
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7