Should I use primary database connection string or read only connection string

Let’s say i want to scale my database for different data centers. What I need to do is to replicate the primary database and create a read-only replicate of it. And DO gives two connection strings, one is the primary and the other is read-only. Which connection string should i use for my app?

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @matthewbennett,

If you want read and write to happen to your managed database cluster you will have to use a primary database connection string.

And when a read-only node is at the different data center which is going to be used for read operations; you can use a read-only node connection string. which can offload read requests/analytics traffic from the primary database.

For more information on read-only nodes:

I hope this helps!

Regards, Rajkishore