Sync two Centos 6 web servers

Daniele Brunengo
Daniele Brunengo used Ask the Experts™
on
Hello, I am about to configure a backup server to my main hosting server.

The main server is a Centos LAMP gigabit server hosting many websites, they are enough now to allow me to afford a backup server.

So, I was wondering, is there a smart, fast way to keep two Centos 6 servers synchronized? I mean everything, from packets to settings and so on, not only website folders and databases.

Is there a way to automatize such a thing, or am I dreaming? Are there ways that almost get there, at least?

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
nociSoftware Engineer
Distinguished Expert 2018

Commented:
This is where puppet etc. come to play.   Problem is puppet & co helps when handling any amount of servers > 1, except that the amount of work involved in maintaining the puppet env. doesn't pay off for a small amount of servers.

What can help is the have all data on DRBD volumes. (that will at least keep the dynamic data synchronised, and failover etc. can be handled using keep alive..., and volumes can be active/active if you applications support that).

For the software side of things (package management) you really need  local setups and update both sides.
If all settings that need to equal are also on a drbd volume (you can have multiple) f.e. using symlinks than the will stay equal as well.

Notable exceptions would be Network settings, as they identify the systems they NEED to be kept SEPARATE.
so /etc/ cannot be on a drbd volume....  same fo /bin  & /sbin as the would be the basic software.
If you are using the systemd startup tooling then /usr cannot be shared as well.  (as systemd distro's tends to blend /bin /sbin /usr/bin & /usr/sbin).     (/usr was in pre-systemd presumed to be on a shared volume (nfs, etc) ,  except that systemd-developers thought that wasn't needed from a disk-size perspective and broke the rules on that).
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
It's as I feared. Too much hassle for two servers, probably. I guess it's more convenient to just keep the servers manually synced as far as settings go, and use rsync to sync files for the www folder.

Is there a way to keep two mysql servers in sync, though? Or will I have to resort to database dumps (which I currently do automatically every 6 hours)?
Software Engineer
Distinguished Expert 2018
Commented:
Check if you can cluster the databases (mariadb should be able to do it, and that is a drop in equivalent for Mysql).
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Distinguished Expert 2017

Commented:
Hosted sites, use content management system, wordpress, joomla, etc.

The config is managed through a DB as noci referenced, db replication/clustering could/would .....
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
Yes, I know, I built all the websites on the server. So probably clustering Mysql would be the solution. But do you know if it takes up a lot of bandwidth?
nociSoftware Engineer
Distinguished Expert 2018

Commented:
That depends on the amount of updates. Only the logs changes are sent across and processed.
so The amount of data written to logs can be an indication.
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
Clustering was actually the way to go.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial