Redis®*

Redis is an open source, in-memory key-value store that supports high throughput and low-latency reads and writes. In practice, it is one of the most flexible and popular caches and datastores.

You can create managed Redis instances on Render with a few clicks.

Getting Started

Here are some examples to get you started with Redis.

These examples will create a background worker to process tasks and a Redis instance to persist and queue the tasks.

Features

Persistent Instance Types

You can create a persistent instance type with up to 10 GB of RAM. Need more RAM? Contact support for a custom plan.

Persistent Redis instances write out to disk every second - we use the default configuration of appendfsync everysec. Data loss of up to 1 second of writes can occur when the instance is terminated.

Metrics

Metrics for memory usage, CPU load, and active connections are available for Redis instances in the Render Dashboard.

Redis metrics overview in dashboard

The default metrics granularity shown is 12 hours, which can be adjusted from 5 minutes to 1 week.

Redis metrics granularity

Blueprint Support

You can create a Redis instance from a blueprint. See the Blueprint YAML Reference for details.

Instance Type Updates

You can update your instance type to a larger instance with more RAM and higher connection limits.

Update Redis instance type

Your Redis instance will be unavailable while updating. Updating a free (ephemeral) Redis instance will delete all data.

Need even more RAM? Contact support for a custom instance type.

Downgrades

It’s not currently possible to downgrade Redis instance types. Make sure to pick the instance type that works for you.

Have a feature you want to see? Let us know by creating a request.

Setting up your Redis

Creating a Redis Instance

You can create a Redis instance on Render in under a minute. Like web services, you can give your Redis instance a memorable name.

New Redis page

Connecting to Your Redis From Services on Render

By default, Redis instances are only available to other Render services in your workspace and have a service address, which is a host:port pair.

Redis dashboard page showing the hostname, port, internal database URL

The Redis instance above has the service address red-c6na6rjru51t7lilgs3g:6379. This means you can connect to it directly from any of your services using hostname red-c6na6rjru51t7lilgs3g at port 6379 — the hostname resolves to a private IP address that only your own services can access.

An internal Redis URL that looks like redis://host:port is also available if your app uses a Redis URL instead of individual connection parameters.


# Connect to your internal Redis instance using the REDIS_URL environment variable
# The REDIS_URL is set to the internal Redis URL e.g. redis://red-343245ndffg023:6379

Sidekiq.configure_server do |config|
    config.redis = {url: ENV.REDIS_URL}
end

Sidekiq.configure_client do |config|
    config.redis = {url: ENV.REDIS_URL}
end

# Simple example from https://github.com/mperham/sidekiq/wiki/Getting-Started
class HardJob
  include Sidekiq::Job

  def perform(name, count)
    # do something
  end
end

HardJob.perform_async('bob', 5)

To use the internal connection, the service and database need to be in the same workspace and region.

Connecting to Your Redis From Outside Render

You might want to connect to your Redis instance from machines outside Render, for example, to run ad-hoc queries. In these cases you can connect to your Redis instance using the external connection string in the External Access section of your Redis settings. Once you have checked Allow connections from outside of your private network, you will have the ability to connect from outside of your private network.

Redis dashboard page showing the (hidden) external connection string and Redis-CLI command

Most Redis clients understand the external connection string. Alternatively, you can choose to connect to the instance using the username, password, host, and port of the instance. The Redis connection string contains all of this information in a format as follows.

rediss://username:password@host:port

The second s in the Redis URL means the connection is TLS secured.

Connecting from outside of Render will result in decreased performance as compared to connecting from within Render, so you should always prefer to use the internal connection parameters when accessing from a Render service in the same region.

Connecting Using redis-cli

The redis-cli is a useful administrative tool for exploring and manipulating data on your Redis instance. There are 2 ways you can use redis-cli with your Redis instance:

  1. If you have a running non-Docker service, redis-cli will be available as part of the environment and is accessible from the service’s shell tab. The service must be in the same region as the Redis instance. You can also SSH into that service and run redis-cli from there.

  2. You can run redis-cli locally on your machine. You will need to install redis-cli onto your machine. A copy and pastable redis-cli command is available in the External Access section of your Redis settings. You will need to enable Allow connections from outside of your private network and configure Access Control of your Redis instance.

External connections are TLS secured. The Redis CLI command provided will include the --tls flag. We recommend using redis-cli v6.2.2+.

Once you have connected, you can set and get keys using various Redis commands.

oregon-redis.render.com:6379> set "render_is_cool" true
OK
oregon-redis.render.com:6379> get "render_is_cool"
"true"
oregon-redis.render.com:6379> KEYS r*
1) "render_is_cool"

Configuring your Redis

Access Control

New Redis instances are inaccessible to any IP address by default. You can configure external connections to your Redis instance in the External Access part of your Redis settings. You can add your own IP addresses in the data access section of your Redis page to access Redis externally. Removing all rules disables all external access.

Redis Access Control Section

You can specify blocks of IP addresses concisely using CIDR notation.

The rules apply to connections from outside Render’s network. Services within the same workspace can always use the internal Redis URL to access their Redis instance.

If your IP address is not in the allow list, you will see the following error from the redis-cli or from your Redis client.

AUTH failed: Client IP address is not in the allowlist.

Redis Versions

Redis version 6.2.14 is used by all Redis instances created after 2024-03-11.

Prior to this date, all instances used version 6.2.5. Render will upgrade these instances to 6.2.14 as part of their next scheduled maintenance.

Maxmemory-Policy

maxmemory-policy dictates how Redis selects what keys to remove when it runs out of memory to store data. You can select the maxmemory-policy when creating a Redis instance based on your use case. We recommend using allkeys-lru for cache use cases or hobby projects and noeviction for queues and other persistent use cases.

Maxmemory-policy Select Options

The different options are as follows:

OptionDocumentationCan memory fill up?
allkeys-lruEvict any key using approximated Least Recently Used (LRU).No
noevictionDon’t evict anything, just return an error on write operations.Yes
volatile-lruEvict using approximated LRU, only keys with an expire set.Yes
volatile-lfuEvict using approximated Least Frequently Used (LFU), only keys with an expire set.Yes
allkeys-lfuEvict any key using approximated LFU.No
volatile-randomRemove a random key having an expire set.Yes
allkeys-randomRemove a random key, any key.No
volatile-ttlRemove the key with the nearest expire time (minor TTL)Yes

You can also modify the maxmemory-policy for an existing instance.

Maxmemory-policy Edit Component for Existing Redis Instances

Restricted Commands

We have restricted usage to most commands in the admin command group, including:

  • failover
  • replicaof
  • save
  • slaveof
  • cluster
  • acl
  • shutdown
  • sync
  • config
  • module
  • pfselftest
  • bgsave
  • debug
  • replconf
  • psync
  • bgrewriteaof
  • pfdebug

You may see a message similar to (error) NOPERM this user has no permissions to run the 'config' command or its subcommand when attempting to use restricted commands.

We have granted exceptions for and allow use of the following commands in the admin command group:

  • client
  • latency
  • slowlog
  • monitor
  • lastsave

*Redis is a registered trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd. Any use by Render Inc is for referential purposes only and does not indicate any sponsorship, endorsement or affiliation between Redis and Render Inc.