2

I have a live server that I want to completely mirror to a 2nd server so if something were to happen to the live server the backup server could simply be plugged in and ready to go.

How do I setup a mirror between 2 separate machines?

5 Answers 5

2

One way to do it is to use the heartbeat package. Install it on both servers and configure them in active-passive mode. If one server failed, the other will be ready to serve the users.

For debian-based systems such as ubuntu, you can install it by;

$ sudo apt-get install heartbeat

You can use three IP addresses for two servers. One IP is assigned for each machine and the third IP (called VIP: virtual IP) is assigned by heartbeat to the currently active server. The users will access the provided service via the VIP.

2

Take a peek at DRBD; it's basically RAID1 over the network:

http://www.drbd.org/

Combined with the Heartbeat package listed above, you can build some very interesting fault-tolerant setups.

Note that we'd need more details to be more helpful. It's possible that application-level fault tolerance is available, depending on what it is you're trying to accomplish.

1

Install the same base OS with the same partition structure onto the spare server and bring it up with its own IP address (this is the easiest way I've found). Personally we then use Bacula to take a weekly full backup of the entire server (with daily incrementals in between) and when we need to recover:

  • Restore entire server onto replacement except for /boot and /etc/fstab
  • If you did restore boot or fstab, at the very least go through both and ensure there's no drive labels or UUIDs listed in /boot/grub/grub.conf or /etc/fstab
  • Ensure the MAC address isn't listed in the network configuration (for RedHat based it's /etc/sysconfig/network-scripts/ifcfg-eth0)
  • Cross your fingers and reboot, it generally just works.

I've not tried it, but you should also be able to rsync between the two servers without need for a backup server.

1

An easy way to set up a hot failover server 100% which is and keeps staying in sync would be drbd together with heartbeat.

Done right the only one who knows that your primary server is broken, stolen, on fire is you because heartbeat send you a warning that the secondary server has taken over.

DRBD is part of the Linux kernel.

Excelent guide: http://www.drbd.org/users-guide/

1

Or are you asking how to just take the server and mirror the whole thing into a cold standby?

In which case you can use systemimager, partimage or (being a bit more oldschool) dd to take a complete drive backup and restore that to a secondary machine. You'd need to make sure its the same hardware spec if you're doing that, but that will then be a complete replica of the live server you can stick in a cupboard and wheel out if needed.

you can also use VMware converter and create a VM of the live server, although on Linux your mileage may vary considerably because it can be flaky.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .