Hi all, so this is my first time asking anything here. Actually, its my first time using DigitalOcean at all and I’m sort of confused about how I should be setting my stuff up.
Here’s the thing, I am building an API service for my mobile app. It will be a REST api and the server will have MySQL and PHP. So when creating my droplets, I have scalability in mind and so I noticed that DigitalOcean has cool stuff called Load Balancer to handle the traffic better between my droplets.
My question is this: I’m going to have two databases, one to have logins and the other to have data which I will serve to the user. Now, lets say that I have two droplets and I’m using a load balancer as well, how would my database will be setup? If I have droplet1 with all my data then I’m guessing I need to create an image out of it and use that for my droplet2 and this way the data between the droplets will be exactly the same, is there another and more dynamic way to do this?
And then lets say that I do create two droplets using the same two image with same exact data but then how will the data going to sync later in the background? The issue I see is that the user starts the app and that connects to droplet1, in which the user will be marked logged in and then when the app continues to progress the second or third call to the server might be made to droplet2 and the login table in that droplet does not have the user marked as logged in and will return empty data set.
I would really appreciate any help, thanks in advance!
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!
The load balancer is for HTTP(s) only. It doesn’t do DB LB. So you’ll need to be able to sync data between the two DBs. Master-master replication is your best bet. Here’s an article to read:
https://www.digitalocean.com/community/tutorials/how-to-set-up-mysql-master-master-replication
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.