[Redis] 特定の文字列を含む key の値を全て取得するコマンド
- 2014 10/7
Redis で、特定の文字列を含む key の値を全て取得するコマンドをメモ
redis-cli KEYS "prefix*" | xargs redis-cli MGET |
Redis で、特定の文字列を含む key の値を全て取得するコマンドをメモ
redis-cli KEYS "prefix*" | xargs redis-cli MGET |
Mac に Redis を Homebrew でインストールする手順をメモ。(最終更新日: 2017/03/31)
まず redis を homebrew でインストールします。
% brew install redis ==> Downloading http://redis.googlecode.com/files/redis-2.6.14.tar.gz ######################################################################## 100.0% ==> make -C /private/tmp/redis-ghPL/redis-2.6.14/src CC=cc ==> 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/2.6.14: 10 files, 1.3M, built in 8 seconds |
PC起動時に、redis を自動起動させたいなら、下記のコマンドを実行します。
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist |
自動起動の設定はせずに、手動で redis を起動させるには下記のコマンドで起動できます。
redis-server /usr/local/etc/redis.conf |
ターミナルから以下の command で Redis へ接続できるか確認します。
% redis-cli redis 127.0.0.1:6379> |
以上です。