• Rob's side project: I recently started Gun-Forums.com and we currently have a $100 raffle - if you're into guns, join up and enter the raffle to win $100.00. Gun Forums

Server backup failover copy

ntw

New Member
Hi, we are currently running a CentOS Web Server which hosts our Database Web Application (nginx and mysql). It has backups all over the place, but we are keen to create a duplicate machine that we could just swicth to should anything happen to it. I've looked at rsync to just keep a current copy of the enrtire system backuped up to the second server, but I'm not sure if that will cover everything, or even if we need to shut down server one to make the initial backup to server two. Does anyone know of the best, most efficient way of accomplishing this please? Any advice would be greatly appreciated. Thanks.
 


Rob

Administrator
Staff member
Best way to do this is to use something like terraform to create the server in the first place, so you can re-create it again with the push of a button.. maybe ansible after it's up so you can push config files, etc..

If you already have it set up, however, you could create a 2nd server and manually set it up with your nginx configs, and set up mysql to replicate from the original server so it's always kept up to date. Then, run rsync between the documentroots from 1st to 2nd server to keep all of the web files syncd.
 

ntw

New Member
Hi Rob, thanks for the reply. Could I just install CentOS on the 2nd server and then copy the files over and then use cron and rsync to keep the copy up-to-date on an hourly basis? Do you think this would work well? I'm also concerned that the sql data be backed up properly and am not sure if just copying the files over will do that job well enough. I'm not sure how else to accomplish this.
 

Rob

Administrator
Staff member
Right, you can install centos on the 2nd, copy all of the web files, nginx config files etc.. but then i'd set up mysql as a slave in replication to the 1st server so it's always kept up to date with the original server.

You could then run db backups from the 2nd server instead of bogging down the 1st server w/ backups.

Something like this should help you to set up the replication:
https://www.rosehosting.com/blog/how-to-setup-mysql-replication-on-centos/
 

ntw

New Member
Sorry, I should have said, the site is still in development (from another machine) so the site is updating all the time, hence the reason for wanting to backup files as well as the database data.

Thanks for the link. I'll read through and have a go!
 


Members online


Latest posts

Top