Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • 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
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Node.js Behavior in Heroku
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
    • Heroku Inference
      • Inference API
      • Quick Start Guides
      • AI Models
      • Inference Essentials
    • Vector Database
    • Model Context Protocol
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • 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
  • Databases & Data Management
  • Heroku Key-Value Store
  • Managing Heroku Key-Value Store Using the CLI

Managing Heroku Key-Value Store Using the CLI

English — 日本語に切り替える

Last updated October 11, 2024

Table of Contents

  • redis:info
  • redis:cli
  • redis:credentials
  • redis:promote
  • redis:timeout
  • redis:maxmemory
  • redis:keyspace-notifications
  • redis:stats-reset

Heroku Key-Value Store (KVS) is integrated directly into the Heroku CLI and offers several commands for managing a KVS instance.

redis:info

To see all KVS instances provisioned by your application and to identify the characteristics of each, use the heroku redis:info command.

$ heroku redis:info
=== maturing-deeply-2628 (REDIS_URL)
Plan:                   Premium 0
Status:                 Available
Created:                2024-09-23 21:40 UTC
Version:                7.2.4
Timeout:                60
Maxmemory:              volatile-lru
Maintenance window:     Mondays 22:30 to Tuesdays 02:30 UTC
Persistence:            AOF
Status:                 Available
Requires TLS:           Yes
Keyspace Notifications: Disabled
Plan Connection Limit:  10000

=== maturing-calmly-4191 (HEROKU_REDIS_AMBER_URL)
Plan:                   Premium 1
Status:                 Available
Created:                2024-09-30 21:40 UTC
Version:                7.2.4
Timeout:                0
Maxmemory:              noeviction
Maintenance window:     Mondays 22:30 to Tuesdays 02:30 UTC
Persistence:            AOF
Status:                 Available
Requires TLS:           Yes
Keyspace Notifications: Disabled
Plan Connection Limit:  10000

redis:cli

To establish a KVS CLI session with your remote KVS instance, use heroku redis:cli. If you don’t specify an instance, then the instance located at REDIS_URL is used by default.

$ heroku redis:cli -a myapp -c myapp
Connecting to maturing-deeply-2628 (REDIS_URL):
ec2-54-221-206-137.compute-1.amazonaws.com:6379> PING
PONG
ec2-54-221-206-137.compute-1.amazonaws.com:6379>

If there are multiple instances, specify the instance to connect to. As a shorthand, you can specify the HEROKU_REDIS_<color> config var name as the first argument to the command, or the resource name maturing-deeply-2628.

$ heroku redis:cli HEROKU_REDIS_AMBER
$ heroku redis:cli maturing-deeply-2628

redis:credentials

Heroku Key-Value Store provides convenient access to the credentials and location of your instance. This makes it easier to use a GUI to access your instance.

The instance name argument must be provided with the redis:credentials command. Use REDIS_URL for your primary data store.

$ heroku redis:credentials REDIS_URL
redis://h:pfl0cfuvr58fhsduesr9kau765k@ec2-54-221-206-137.compute-1.amazonaws.com:6379

It’s a good security practice to rotate the credentials for important services on a regular basis. On Heroku Key-Value Store, use heroku redis:credentials --reset to rotate credentials.

$ heroku redis:credentials HEROKU_REDIS_GRAY_URL --reset

When you issue this command, new credentials are created for your instance and the related config vars on your Heroku application are updated.

All of the open connections remain open until the currently running tasks complete. This is to make sure that any background jobs or other workers running on your production environment aren’t abruptly terminated, potentially leaving the system in an inconsistent state. Any new connections opened after the credentials rotation has been run but before dynos have restarted with the new value of the config var will fail.

redis:promote

In configurations where with multiple KVS instances provisioned, it’s often necessary to promote an instance to the primary role. You can promote an instance using the heroku redis:promote command.

$ heroku redis:promote shining-surely-6441 -a myapp
Promoting shining-surely-6441 to REDIS_URL on myapp

redis:promote works by setting the value of the REDIS_URL config var (which your application uses to connect) to the newly promoted instance’s URL and restarting your app. The old primary KVS instance location is still accessible via its HEROKU_REDIS_COLOR_URL setting.

After a promotion, the demoted instance is still provisioned and incurring charges. If it’s no longer needed, remove it with heroku addons:destroy maturing-deeply-2628.

redis:timeout

To change the number of seconds KVS waits before killing idle connections, use the redis:timeout command:

$ heroku redis:timeout maturing-deeply-2628 --seconds 60
Timeout for maturing-deeply-2628 (REDIS_URL) set to 60 seconds.
Connections to the redis instance will be stopped after idling for 60 seconds.

redis:maxmemory

To change the key eviction policy used when an instance reaches its storage limit, use the redis:maxmemory command:

$ heroku redis:maxmemory maturing-deeply-2628 --policy volatile-lru
Maxmemory policy for maturing-deeply-2628 (REDIS_URL) set to volatile-lru.
volatile-lru evicts keys trying to remove the less recently used keys first, but only those that have an expiry set.

redis:keyspace-notifications

Heroku Key-Value Store supports keyspace notifications. To configure this, use the redis:keyspace-notifications command:

$ heroku redis:keyspace-notifications maturing-deeply-2628 --config AKE
Keyspace notifications for maturing-deeply-2628 (REDIS_URL) set to 'AKE'.

A number of possible configurations are possible. Consult heroku help redis:keyspace-notifications for more.

redis:stats-reset

Resets the statistics on your Heroku Key-Value Store instance. This article outlines the statistics that are reset:

$ heroku redis:stats-reset maturing-deeply-2628
 ▸    WARNING: Irreversible action.
 ▸    All stats covered by RESETSTAT will be reset on maturing-deeply-2628.
 ▸    To proceed, type sushi or re-run this command with --confirm sushi

> sushi
Stats reset successful.

Keep reading

  • Heroku Key-Value Store

Feedback

Log in to submit feedback.

Upgrading a Heroku Key-Value Store Version Understanding Heroku Key-Value Store Log Statements and Common Errors

Information & Support

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

Language Reference

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

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices