Skip Navigation
Show nav
Heroku Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Dynos (app containers)
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Command Line
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery
    • Continuous Integration
  • Language Support
    • Node.js
    • Ruby
      • Rails Support
      • Working with Bundler
    • Python
      • Background Jobs in Python
      • Working with Django
    • Java
      • Working with Maven
      • Java Database Operations
      • Working with the Play Framework
      • Working with Spring Boot
      • Java Advanced Topics
    • PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
    • Heroku Data For Redis
    • Apache Kafka on Heroku
    • Other Data Stores
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
    • Compliance
  • Heroku Enterprise
    • Private Spaces
      • Infrastructure Networking
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
    • Single Sign-on (SSO)
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Add-ons
  • All Add-ons
  • Redis Enterprise Cloud
Redis Enterprise Cloud

This add-on is operated by Redislabs

From the creators of Redis. Enterprise-Class Redis for Developers (w/ Free plan)

Redis Enterprise Cloud

Last updated August 31, 2022

Table of Contents

  • Getting started
  • Using Redis from Ruby
  • Configuring Redis on Rails
  • Configuring Redis on Sinatra
  • Using Redis from Java
  • Using Redis from Python
  • Configuring Redis on Django
  • Using Redis from PHP
  • Using Redis from Node.js
  • Dashboard
  • Database Backups
  • Migrating from an existing Redis server to Redis Cloud
  • Adding Redis databases to your plan
  • Migrating between plans
  • Removing the add-on
  • Support
  • Additional resources

Redise Cloud is a fully-managed cloud service for hosting and running your Redis dataset in a highly-available and scalable manner, with predictable and stable top performance. You can quickly and easily get your apps up and running with Redise Cloud through its add-on for Heroku, just tell us how much memory you need and get started instantly with your first Redis database. You can then add more Redis databases (each running in a dedicated process, in a non-blocking manner) and increase or decrease the memory size of your plan without affecting your existing data.

Redise Cloud offers true high-availability with its in-memory dataset replication and instant auto-failover mechanism, combined with its fast storage engine. You can easily import an existing dataset to any of your Redise Cloud databases, from your S3 account or from any other Redis server. Daily backups are performed automatically and in addition, you can backup your dataset manually at any given time. The service guarantees high performance, as if you were running the strongest cloud instances.

Getting started

Start by installing the add-on:

A list of all plans available can be found here.

$ heroku addons:create rediscloud

Once Redise Cloud has been added, you will notice a REDISCLOUD_URL config vars in your heroku config containing the username, password, hostname and port of your first Redis Cloud database.

$ heroku config:get REDISCLOUD_URL
http://rediscloud:password@hostname:port

Next, setup your app to start using the Redise Cloud add-on. In the following sections we have documented the interfaces with several languages and frameworks supported by Heroku.

Using Redis from Ruby

The redis-rb is a very stable and mature redis client and the easiest way to access Redis from Ruby.

Install redis-rb:

sudo gem install redis

Configuring Redis on Rails

For Rails 2.3.3 up to Rails 3.0, update the config/environment.rb to include the redis gem:

config.gem 'redis'

For Rails 3.0 and above, update the Gemfile:

gem 'redis'

And then install the gem via Bundler:

bundle install

Lastly, create a new redis.rb initializer in config/initializers/ and add the following code snippet. For Rails before version 4:

if ENV["REDISCLOUD_URL"]
    uri = URI.parse(ENV["REDISCLOUD_URL"])
    $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end

For Rails 4:

if ENV["REDISCLOUD_URL"]
    $redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
end

Configuring Redis on Sinatra

Add this code snippet to your configure block:

configure do
    . . .
    require 'redis'
    uri = URI.parse(ENV["REDISCLOUD_URL"])
    $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
    . . .
end

Using Redis on Unicorn

No special setup is required when using Redise Cloud with a Unicorn server. Users running Rails apps on Unicorn should follow the instructions in the Configuring Redis from Rails section and users running Sinatra apps on Unicorn should follow the instructions in the Configuring Redis on Sinatra section.

Testing (Ruby)

$redis.set("foo", "bar")
# => "OK"
$redis.get("foo")
# => "bar"

A Sinatra sample application is available at GitHub.
Browse the source code or Deploy

Using Redis from Java

Jedis is a blazingly small, sane and easy to use Redis java client. You can download the latest build from github or use it as a maven dependency:

<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>2.0.0</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

Configure connection to your Redise Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

try {
        URI redisUri = new URI(System.getenv("REDISCLOUD_URL"));
        JedisPool pool = new JedisPool(new JedisPoolConfig(),
                redisUri.getHost(),
                redisUri.getPort(),
                Protocol.DEFAULT_TIMEOUT,
                redisUri.getUserInfo().split(":",2)[1]);
} catch (URISyntaxException e) {
        // URI couldn't be parsed.
}

Testing (Java)

Jedis jedis = pool.getResource();
jedis.set("foo", "bar");
String value = jedis.get("foo");
// return the instance to the pool when you're done
pool.returnResource(jedis);

(example taken from Jedis docs).

A Java sample application, running on Play!, is available at GitHub.
Browse the source code or Deploy

Using Redis from Python

redis-py is the most common client to access Redis from Python.

Use pip to install it:

sudo pip install redis

Configure connection to your Redise Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

import os
import urlparse
import redis
url = urlparse.urlparse(os.environ.get('REDISCLOUD_URL'))
r = redis.Redis(host=url.hostname, port=url.port, password=url.password)

Testing (Python):

>>> r.set('foo', 'bar')
True
>>> r.get('foo')
'bar'

Configuring Redis on Django

Redis can be used as the back-end cache for Django.

To do so, install django-redis-cache:

pip install django-redis-cache

Next, configure your CACHES in the settings.py file:

import os
import urlparse
redis_url = urlparse.urlparse(os.environ.get('REDISCLOUD_URL'))
CACHES = {
        'default': {
            'BACKEND': 'redis_cache.RedisCache',
            'LOCATION': '%s:%s' % (redis_url.hostname, redis_url.port),
            'OPTIONS': {
                'PASSWORD': redis_url.password,
                'DB': 0,
        }
    }
}

Testing (Django)

from django.core.cache import cache
cache.set("foo", "bar")
print cache.get("foo")

A Django sample application is available at GitHub.
Browse the source code or Deploy

Using Redis from PHP

Predis is a flexible and feature-complete PHP client library for Redis.

Instructions for installing the Predis library can be found here.

Loading the library to your project should be straightforward:

<?php
// prepend a base path if Predis is not present in your "include_path".
require 'Predis/Autoloader.php';
Predis\Autoloader::register();

Configure connection to your Redise Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

$redis = new Predis\Client(array(
    'host' => parse_url($_ENV['REDISCLOUD_URL'], PHP_URL_HOST),
    'port' => parse_url($_ENV['REDISCLOUD_URL'], PHP_URL_PORT),
    'password' => parse_url($_ENV['REDISCLOUD_URL'], PHP_URL_PASS),
));

Testing (PHP)

$redis->set('foo', 'bar');
$value = $redis->get('foo');

A PHP sample application is available at GitHub.
Browse the source code or Deploy

Using Redis from Node.js

node_redis is a complete Redis client for node.js.

You can install it with:

npm install redis

Configure connection to your Redise Cloud service using REDISCLOUD_URLconfig vars and the following code snippet:

var redis = require('redis');
var client = redis.createClient(process.env.REDISCLOUD_URL, {no_ready_check: true});

Testing (Node.js)

client.set('foo', 'bar');
client.get('foo', function (err, reply) {
    console.log(reply.toString()); // Will print `bar`
});

A Node.js sample application is available at GitHub.
Browse the source code or Deploy

Dashboard

Our dashboard presents all performance and usage metrics of your Redis Cloud service on a single screen, as shown below:

Dashboard

To access your Redise Cloud dashboard run:

heroku addons:open rediscloud

You can then find your dashboard under the MY DATABASES menu.

Alternatively, open the Redise Cloud add-on from your application’s dashboard at heroku.com.

Database Backups

You can access the backups of your database from our dashboard via the MY DATABASES > Manage menu. After you select a database from that page, use the Backup Now button to create an on-demand backup or the My Backups link for a list of links to your database’s backup files. Backups are available only for paid plans.

Note that backups are available only on paid plans.

Migrating from an existing Redis server to Redis Cloud

You can also create a Redise Cloud instance and populate it with your existing dataset running on another Redis server, by using the following command-line:

$ heroku addons:create rediscloud:<plan size> --fork=redis://<password>@<host>:<port>

If you’re migrating from another add-on you can have the URL automatically substituted in:

$ heroku addons:create rediscloud:<plan size> --fork=`heroku config:get MYREDIS_URL`

Change MYREDIS_URL in this example to the config var that contains your existing Redis connection URL.

Adding Redis databases to your plan

Redise Cloud allows you to add multiple Redis databases to your plan, each running in a dedicated process, in a non-blocking manner (i.e. without interfering with your other databases). You can create as many databases as you need, limited by the memory size of your plan.

Your first Redis database is created automatically upon launching the Redise Cloud add-on and its URL and credentials are maintained in REDISCLOUD_URLconfig vars. To add more databases, simply access your Redise Cloud console and click the New DB button in the MY DATABASES > Manage page.

The Redise Cloud console will provide you a new URL for connecting to your new Redis database.

Migrating between plans

Plans migration is easy and instant. It requires no code change and has no effect on your existing datasets. You can use the ‘heroku addons:upgrade’ command to migrate to a new plan:

An example of how to upgrade to a 5GB plan

$ heroku addons:upgrade rediscloud:5000

Removing the add-on

Redise Cloud can be removed via the following command:

This will destroy all associated data and cannot be reversed!

$ heroku addons:destroy rediscloud

Support

All Redise Cloud support and runtime issues should be submitted via the Heroku Support channels. We recommend CC:ing support@redislabs.com for urgent issues. We are also available on twitter @RedisLabs.

Additional resources

  • Developers Resources
  • Redis Documentation

Keep reading

  • All Add-ons

Feedback

Log in to submit feedback.

Ziggeo RedisGreen

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Podcasts
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing

Subscribe to our monthly newsletter

Your email address:

  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Heroku Podcasts
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Facebook
  • Instagram
  • Github
  • LinkedIn
  • YouTube
Heroku is acompany

 © Salesforce.com

  • heroku.com
  • Terms of Service
  • Privacy
  • Cookies
  • Cookie Preferences