develop with

Setup Redis

Setup and configuring redis for development

How to setup Redis

Redis is a key value store that mostly works in memory. Unlike memcached it can page some of the cache to disk.

Setup on OS X

To install on OS X:

brew install redis

After you have installed via brew, you’ll need to setup the launch agents for it by running the following:

mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/Cellar/redis/*/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

To start on homebrew install:

launchctl start homebrew.mxcl.redis

To stop on homebrew install:

launchctl stop homebrew.mxcl.redis

Tip: You can see a list of all services running in launchctl by running `launchctl list`

Configuration is stored in /usr/local/etc/redis.conf.

Setup on Ubuntu

To install on Ubuntu:

 sudo apt-get install redis-server

To start the service on Ubuntu:

sudo service redis-server start


Redis comes with a command line tool to run the commands against the redis db. The command line tool is called redis-cli. And this can be used to get all keys for instance, redis-cli KEYS "*".

Handy way to delete all keys that match a prefix:

redis-cli KEYS "mykey:*" | xargs redis-cli DEL

You can try redis-cli online via Try Redis.

comments powered by Disqus

Want to see a topic covered? create a suggestion

Get more developer references and books in the developwith store.