I am installing a debian server and I need to install a mirror of that server, so that in case of problems with the main one, the users can connect to the mirror transparently. Any change in the main server should be reflected in the second one. Mostly i would have to sync postgresql and mysql datababases, but if possible the whole system.

What are my options ?

Edit: This is what i was looking for: http://www.howtoforge.com/installing-a-web-email-and-mysql-database-cluster-on-debian-6.0-with-ispconfig-3


Both postgres and mysql have different means to cluster. This is not a task to be taken trivially and requires a great deal of experience and knowledge of both in order to deploy successfully.

How often do the databases update? Is is just during office hours, for example, if so, your task will be simpler.

If you wish to mirror the entire system, a trivial way could be to install both computers, then use dump(8) and restore(8) to copy the entire file system contents to the backup node at say, 4am.

If you want to have a hot standby, things get a little more complex as you need some cooperation between the two, and a service that can switch between hosts when there is a fault. Linux-HA is a good place to start for this. There's DRBD too, which is RAID1 over network, quite interesting, but again, needs some experience to get to know it.

If you wish to have mysql in a cluster, look at the federation engine, but this is quite a lot slower than InnoDB. So, how important is it. Would, putting your first system on internal RAID(1,5,6) be sufficient to cater for disk failure, whilst having a system next to it ready to take disks should the motherboard/CPU/RAM fail.

If you're happy to taint your kernel with foreign software, there's zfsonlinux. That's quite handy, your second system can have the fileystem unmounted, whist the first (live) one runs a zfs send pool0@YYYYMMDDHHmm | ssh ... to the standby. When you need to bring your service online at the standby, just mount the file system, start your system services, and fix the first system. Then do the reverse to send the changes back.

  • For InnoDB replication I would prefer Galera Cluster based solutions, like Percona XtraDB Cluster or MariaDB's similar implementation. Oct 25 '14 at 1:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.