Question

Managed Redis and multiple app platform instances

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?


Submit an answer


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!

Sign In or Sign Up to Answer

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.

Accepted Answer

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.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

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.