I'm about to begin coding a SaaS project that has to do with client management for small businesses. It's just a hobby project for me right now which is why I'm allowing myself to code it instead of paying a developer to do it for me. My experience in PHP coding and working with server back ends is intermediate at best.
I've been reading into MySQL replication a bit so I can have a backup, but up to date, DB ready in case something should happen to my main server.
I already plan on having a staging server which will be identical to the main server. All files, crons, etc. Only difference is that no real customer data will be stored in its MySQL DB. It will be used for testing all updates before going live.
My questions:
Theoretically, my main server goes down... I change "localhost" to the IP of my Mysql replication slave server in the config file for connecting to the DB on my staging server, and point the domain to the staging server. Website should then be back up and working, correct?
If that's correct, what happens when the main server comes back up, and the slave MySQL server starts trying to pull data from the master again, which will be missing any new data that's gone in during downtime?
And lastly, What kind of specs (relative to main server) does the slave MySQL server need? I've never had a server that was purely used for an MySQL DB and nothing else. Would be a terrible idea to put it on a small VPS to start?
Hopefully these questions made some sense haha.
I've been reading into MySQL replication a bit so I can have a backup, but up to date, DB ready in case something should happen to my main server.
I already plan on having a staging server which will be identical to the main server. All files, crons, etc. Only difference is that no real customer data will be stored in its MySQL DB. It will be used for testing all updates before going live.
My questions:
Theoretically, my main server goes down... I change "localhost" to the IP of my Mysql replication slave server in the config file for connecting to the DB on my staging server, and point the domain to the staging server. Website should then be back up and working, correct?
If that's correct, what happens when the main server comes back up, and the slave MySQL server starts trying to pull data from the master again, which will be missing any new data that's gone in during downtime?
And lastly, What kind of specs (relative to main server) does the slave MySQL server need? I've never had a server that was purely used for an MySQL DB and nothing else. Would be a terrible idea to put it on a small VPS to start?
Hopefully these questions made some sense haha.