Report this

What is the reason for this report?

Managed Redis and multiple app platform instances

Posted on February 2, 2025

I have two app platform Django instances for a staging and production environment. Both have celery and celery beat. I’m paying for two Managed Redis instances. I’d like to pay for only one.

I’ve seen that you can use multiple databases in the same Redis instance (i.e. 'redis://redis-cluster-url:6379/1' or 'redis://redis-cluster-url:6379/2').

But when you attach a DB in app platform, you access the environment variable with something like this: ${dbname.REDIS_URL}.

Is it possible to change the database instance in Managed Redis (/1 or /2)? Is there a way to change the database instance in app platform? Or do you have to do the full connection string with the database id instead?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Figured it out. Yes, you can assign a database ID for managed Redis. In app platform, I changed my environment variables to:

production

${dbname.REDIS_URL}/1

staging

${dbname.REDIS_URL}/2

I’m still interested in learning if there is a better way to do this and what performance limitations this might have.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.