By phosphide
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!
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.