openredis logo

Docs | Pricing | Log in | Sign up

Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. More information can be found at

openredis is accessible via an API and has supported client libraries for C, C#, C++, Clojure, Dart, Erlang, Fancy, Go, Haskell, Io, Java, Lua, Node.js, Objective C, Perl, PHP, Python, Ruby, Scala, Smalltalk and Tcl.

This is how your dashboard will look like once the add-on is integrated:

openredis dashboard

Provisioning the add-on

If you haven't subscribed already, please check our guide to subscribing.

Local setup

Environment setup

After provisioning the add-on it’s necessary to locally replicate the config vars so your development environment can operate against the service.

Though less portable it's also possible to set local environment variables using `export OPENREDIS_URL=value`.

Use Foreman to reliably configure and run the process formation specified in your app’s Procfile. Foreman reads configuration variables from an .env file. Use the following command to add the OPENREDIS_URL values retrieved from heroku config to .env.

$ echo 'OPENREDIS_URL=redis://...' >> .env
$ more .env

Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env file with: `echo .env >> .gitignore`.

Using Redis from Ruby

Using Redis from Ruby is very straightforward. Start by installing the Redis client:

$ gem install redis

Now, create a client and connect it to Redis:

$redis = Redis.connect :url => ENV["OPENREDIS_URL"]

Setup for Sinatra

require "redis"

class MyApp < Sinatra::Base
  configure do
    $redis = Redis.connect :url => ENV["OPENREDIS_URL"]

Setup for Rails 3.x

Ruby on Rails applications will need to add the following entry into their Gemfile specifying the openredis client library.

gem "redis"

Update application dependencies with bundler.

$ bundle install

You can connect to Redis by using the OPENREDIS_URL:

$redis = Redis.connect :url => ENV["OPENREDIS_URL"]

Using Redis from Python

Install redis-py:

$ sudo pip install redis # or sudo easy_install redis

Then connect to Redis:

import redis

client = redis.from_url(ENV["OPENREDIS_URL"])

Using Redis from Node.js

Install node_redis:

$ npm install redis

Then use the following snippet to connect to Redis:

var url   = require("url").parse(process.env.OPENREDIS_URL);
var redis = require("redis").createClient(url.port, url.hostname);


Using Redis from Java

Install Jedis by following the author's instructions.

Then use the following snippet to connect to Redis:

URI url = new URI(System.getenv("OPENREDIS_URL"));

JedisPool pool = new JedisPool(new JedisPoolConfig(),
    url.getUserInfo().split(":", 2)[1]);

Development environment

When developing locally it is best to turn off the integration with openredis to minimize dependencies on remote services. You can use a local Redis server, and point OPENREDIS_URL to localhost and the appropriate port.

For example:

ENV["OPENREDIS_URL"] = "redis://localhost:6379"

$redis = Redis.connect(:url => ENV["OPENREDIS_URL"])


Important note: Starting November 14, 2012, all plans provisioned in AWS are accessible only from within the AWS network.

Make sure you can connect with redis-cli. If that works, check you are getting the credentials right in your application. For support questions, you can find us at #openredis on Freenode, mention @openredis on Twitter, or simply email us at

Additional resources

Additional resources are available at: