This add-on is operated by Stovepipe Studios, Inc.
Redis 7.0, Instrumented and Scaled
Memetria for Redis®*
Last updated October 11, 2022
Table of Contents
Memetria for Redis is an add-on for a high-performance, durable Redis database. It provides:
- Autoscaling: resize without downtime, and automatically upgrade at plan limits
- Encryption: dual and TLS-only connectivity
- Continuous backups with easy import and export
- Detailed monitoring to track large keys and monitor memory allocations
Provisioning the Add-on
Add Memetria for Redis to an app via the Heroku CLI:
$ heroku addons:create memetria-redis:minidev
Adding memetria-redis:minidev to fancy-slinky-2001... done, v24 ($14/mo)
Your Memetria database has been built. You can find MEMETRIA_REDIS_URL in your Heroku config
Created memetria-redis-adjacent-38367 as MEMETRIA_REDIS_URL
Use `heroku addons:docs memetria-redis:minidev` to view documentation
After provisioning Memetria for Redis, the MEMETRIA_REDIS_URL
config var is
available in the attached app’s configuration. It contains the Redis URI for
your Redis server. You can see the config var via the heroku config:get
command:
$ heroku config:get MEMETRIA_REDIS_URL
redis://default:PASSWORD@HOST:PORT
For example:
$ heroku config:get MEMETRIA_REDIS_URL
redis://default:gnysfn55t65g72ntd4g0a6h8ea91ca9v@smart-panda.memetria.net:10042
Provisioning Multiple Memetria for Redis Add-ons
You can attach multiple Memetria for Redis add-ons to your app multiple times to create separate dedicated databases for different purposes:
$ heroku addons:add memetria-redis:minidev
Adding memetria-redis:minidev to fancy-slinky-2001... done, v25 ($14/mo)
Your Memetria database has been built. You can find MEMETRIA_REDIS_URL in your Heroku config
Created memetria-redis-curved-92092 as MEMETRIA_REDIS_AQUA_URL
Use `heroku addons:docs memetria-redis:minidev` to view documentation
Each Memetria for Redis database has its own URL in your Heroku app config:
$ heroku config | grep MEMETRIA
MEMETRIA_REDIS_URL: redis://default:PASSWORD@HOST:PORT
MEMETRIA_REDIS_AQUA_URL: redis://default:PASSWORD@HOST:PORT
Attaching Memetria for Redis to Other Apps
After provisioning Memetria for Redis, you can attach it to other Heroku apps.
Find the addon ID with heroku addons
$ heroku addons
Add-on Plan Price State
────────────────────────────────────────────── ─────── ────────── ───────
memetria-redis (memetria-redis-adjacent-38367) minidev $14/mo created
└─ as MEMETRIA_REDIS
memetria-redis (memetria-redis-curved-92092) minidev $14/mo created
└─ as MEMETRIA_REDIS_AQUA
And attach the database to an app using the addon ID:
$ heroku addons:attach memetria-redis-adjacent-38367
Memetria Dashboard
The Memetria dashboard provides graphs, alerts, diagnostic information, and more. Access the Memetria dashboard through your app’s Heroku Dashboard page or through the Heroku CLI:
$ heroku addons:open memetria
You can also consult Memetria’s own documentation at www.memetria.com/docs.
Managing Redis Versions
Memetria for Redis supports multiple versions. You can choose the Redis version
that is appropriate for your application or use Memetria’s recommended setting
in the Settings
panel of the Memetria dashboard.
Security patches and minor versions are automatically applied.
Custom Configuration
Many settings can be configured directly from your Memetria dashboard. If you
need custom configuration, you can click the Support
button in the
Memetria dashboard or email us at
support@memetria.com and we’ll work
with you to implement the best configuration for your particular needs.
Rotating Credentials
To rotate credentials for your Memetria for Redis server, click the Support
button
in the Memetria dashboard and request a credential rotation. This rotation pushes a new MEMETRIA_REDIS_URL
to your application and restarts your dynos with the new credentials. Memetria’s support team confirms the rotation before disabling the old
credentials.
Local Setup
Environment Setup
After provisioning Memetria for Redis, you can replicate its config vars locally for development environments that require it.
Use the local
Heroku CLI
command to configure, run, and manage process types specified in your app’s
Procfile. Heroku Local reads configuration variables from a .env
file. Use heroku config
to view an app’s configuration variables in a
terminal. Use the following command to add a configuration variable to a local
.env
file:
$ heroku config:get MEMETRIA_REDIS_URL -s >> .env
Your Memetria Redis URL is sensitive and should not be committed to source
control. In Git exclude the .env
file with: echo .env >> .gitignore
.
For more information, see the Heroku Local article.
Language-Specific Integrations
Using Redis with Ruby
Add the redis
and connection_pool
gems to your Gemfile:
gem 'connection_pool'
gem 'redis'
Run bundle install
to install them.
For Rails apps, configure your cache store to use Memetria for Redis, in
config/environments/production.rb
:
config.cache_store = :redis_cache_store, {
url: ENV["MEMETRIA_REDIS_URL"],
}
If you’re using Sidekiq, supply the Memetria for Redis URL
in a Sidekiq initializer (config/initializers/sidekiq.rb
):
Sidekiq.configure_server do |config|
config.redis = { url: ENV["MEMETRIA_REDIS_URL"] }
end
Create a Client
You can create a client with:
redis = Redis.new(url: ENV["MEMETRIA_REDIS_URL"])
Or access through a connection pool for use within multithreaded environments like Sidekiq and Puma:
redis = ConnectionPool.new { Redis.new(url: ENV["MEMETRIA_REDIS_URL"]) }
redis.with do |client|
client.set("greeting", "hello, world!")
client.get("greeting") # => 'hello, world!'
end
Using Redis with Python
Install the redis
package:
pip install redis
To use Redis as a cache backend for your Django app with django-redis:
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": os.getenv("MEMETRIA_REDIS_URL"),
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
}
}
}
To use Memetria for Redis as your session store, you must also update your Django session engine settings:
SESSION_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default"
Create a Client
Create your Redis connection with:
import os, redis
redis = redis.from_url(os.getenv("MEMETRIA_REDIS_URL"))
Using Redis with Node.js
Install the ioredis
package using npm
:
$ npm install ioredis
You can then create your Redis connection with:
const Redis = require("ioredis");
const redis = new Redis(process.env.MEMETRIA_REDIS_URL);
Using Redis with PHP
The predis
library is recommended. Add the library to your composer.json
file:
composer require predis/predis
And connect by using the MEMETRIA_REDIS_URL
config var:
$redis = new Predis\Client(getenv('MEMETRIA_REDIS_URL'));
Plan Management
Automatic Upgrades
Automatic Upgrades are enabled by default on all Memetria for Redis databases. If you reach the memory limits of your plan, Memetria automatically upgrades you to the next size and send you a notification.
If your memory usage returns within the plan limits, no action is necessary: Memetria restores your plan to the previous size without affecting your application.
If you choose to make the automatic upgrade permanent, you must change the plan size on Heroku. See Migrating Plans for more info.
If you choose not to keep the upgraded plan size, Memetria begins enforcing the limits of your Heroku plan after notifying you.
You can disable automatic upgrades at any time from the Settings
menu in the
Memetria dashboard.
Migrating Plans
When you alter the plan of your Memetria for Redis database, your hostname stays the same and your database stays online and available.
You can choose new plan sizes via your Heroku dashboard, or with the CLI:
$ heroku addons:upgrade memetria-redis:dev
Changing memetria-redis-shaped-48055 on calm-beach-06843 from memetria-redis:minidev to memetria-redis:dev... done, ($39/mo)
Migration to the Development plan started. Your Redis URL will remain the same.
Removing the Add-on
You can remove Memetria for Redis from your app via the Heroku CLI:
This action destroys all associated data and you can’t undo it! Download the most recent backup from the dashboard before removing the add-on.
You can download your latest backup from your Memetria for Redis database by
visiting your Memetria dashboard (heroku addons:open memetria-redis
) and
navigating to the Backup list by clicking Settings
then Backups
.
After downloading your data, remove your Memetria for Redis addon:
$ heroku addons:destroy memetria-redis
! WARNING: Destructive Action
! This command will affect the app: example-app
! To proceed, type "example-app" or re-run this command with --confirm example-app
> example-app
Removing memetria-redis:minidev from example-app... done, v25 ($14/mo)
Additional Support
Use the Support
button in the Memetria dashboard or email
support@memetria.com to get help with
any aspect of your Memetria for Redis server, including custom configurations.