Trying to figure out how to setup my droplets
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!
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.