Redis is an open source, in-memory data structure store, used as database, cache and message broker. It is one of the most popular key-value nosql database. Also note that the name Redis means REmote DIctionary Server.
Here are installation steps for redis on Mac using brew.
-
Get redis package info
$ brew info redis redis: stable 3.0.7 (bottled), HEAD Persistent key-value database, with built-in net interface
Home
Not installed From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/redis.rb ... ... -
Install redis using brew
$ brew install redis
-
List installed files
$ brew list redis /usr/local/Cellar/redis/3.0.7/bin/redis-benchmark /usr/local/Cellar/redis/3.0.7/bin/redis-check-aof /usr/local/Cellar/redis/3.0.7/bin/redis-check-dump /usr/local/Cellar/redis/3.0.7/bin/redis-cli /usr/local/Cellar/redis/3.0.7/bin/redis-sentinel /usr/local/Cellar/redis/3.0.7/bin/redis-server /usr/local/Cellar/redis/3.0.7/homebrew.mxcl.redis.plist
-
In case you want to start redis at login add symlink in ~/Library/LaunchAgents. Note that it will start redis as current user. This info can also be obtained by command
brew info
.$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
-
To start redis one time as current user:
$ launchctl load /usr/local/opt/redis/homebrew.mxcl.redis.plist
-
View redis config
$ less /usr/local/etc/redis.conf
-
View redis log
$ tail -f /usr/local/var/log/redis.log ... 59980:M 03 Mar 14:01:37.643 # Server started, Redis version 3.0.7 59980:M 03 Mar 14:01:37.658 * DB loaded from disk: 0.015 seconds 59980:M 03 Mar 14:01:37.658 * The server is now ready to accept connections on port 6379
-
Look at redis db file
$ ls -l /usr/local/var/db/redis/ -rw-r--r-- 1 user1 admin 33 Jan 21 09:33 dump.rdb
- Try out few redis-cli commands
$ echo "set key1 value1" | redis-cli OK $ echo "INFO keyspace" | redis-cli # Keyspace db0:keys=1,expires=0,avg_ttl=0 $ echo "KEYS *" | redis-cli 1) "key1"
You may also want to visit redis cli quick start tutorial