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:
- 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).
- How to build a Ceph Distributed Storage Cluster on CentOS 7
- How to Setup DRBD to Replicate Storage on Two CentOS 7 Servers
- How To Create a Redundant Storage Pool Using GlusterFS on Ubuntu 18.04
- An Introduction to the Z File System (ZFS) for Linux
Quick & Dirty: Cross Sync
Let’s use a simple cronjob every hour to sync the whole shared folder to all remote locations.
rsync -e "ssh -i $HOME/.ssh/somekey" -auv --progress /path/to/shared/folder/ [email protected]<IP2>:/path/to/shared/folder
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.
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.