Save yourself from a disaster #4: Redundancy of Storage

This is the fourth part of the series Save yourself from a disaster: Redundancy on a budget.

How can we make sure our second most important asset is safely secured in case of a disaster?

We could mainly 2 things:

Disclaimer
This guide won’t cover everything, it won’t be a comprehensive guide, and the steps that are shown need to be carefully reviewed and tested in your development/pre-production environment. I don’t take any responsibility for any damage, interruption of service nor leak/loss of data for the use of the instructions in the ebook (nor from any external website I’ve mentioned).

Distributed Storage

Although we could use some distributed filesystem like Ceph, DRBD, GlusterFS, or ZFS, then it won’t be on a budget and also the complexity introduced by those tools will need to addressed properly. I will not cover it here due to the costs of extra nodes and extra configuration needed – you’re time have a cost too (but if your filesystem changes frequently this is your only option).

Ad-Hoc Solutions

Quick & Dirty: Cross Sync

Let’s use a simple cronjob every hour to sync the whole shared folder to all remote locations.

Server #1:

rsync -e "ssh -i $HOME/.ssh/somekey" -auv --progress /path/to/shared/folder/ [email protected]<IP2>:/path/to/shared/folder

Server #2:

rsync -e "ssh -i $HOME/.ssh/somekey" -auv --progress /path/to/shared/folder/ [email protected]<IP1>:/path/to/shared/folder

Remember, this is not a proper distributed solution, rsync looks like an old-fashioned solution, it did save me lots of times. This approach is not feasible for “real-time” synchronization, they are just for (very) infrequent changes. Distributed filesystem like GlusterFS (or Ceph, or DRBD) are solutions for the long run.

Security

Remember to secure the connection between one host to the others (eg. with a firewall).


The next post will be about Redundancy of Web Servers, Stay Tuned.

Check out the whole version of this post in the ebook.