Lately I have been all over the shop with the things that peak my interest... In the last few days I have been toying around with some of the replication and synchronization tools that I never seen before. The first one that I totally struggled (aka failed) to get up and running was the OCFS2 (Oracle Clustered File System 2). You can call me stupid and ignorant but I could not get this to replicate at all. I have setup virtual machines to test this out and even tried it on two physical servers and nothing. The cluster did not want to register on one node while on the other things seem to be fine despite me executing the same commands on both (nearly the same as they obviously need to be slightly different to reflect the config files etc). So after a day of reading tutorials on the internet, re-installing the virtual machines several times and troubleshooting I gave up. This was meant to be this fun tool that will allow me to convert my servers into a Highly Available Virtual Machine storage... yeah, that did not work out at all. And it is not that I expect it to be perfect or anything. I just wanted to have a feel on its performance and how it behaves in general. Seems like for now I will be using the good old GlusterFS for replication after all.
Lsyncd on the other hand was compliant to my whims It all worked perfectly out of the box within 30 minutes of reading the documentation and following a tutorial on how to get started. In short what it allows you to do is to mirror one directory (with all of the content) to another directory. This can be done within the same server / PC or across the network (the second option seems a bit more useful). So I configured two of my Dell Servers to give that a go. My setup was: server B is mirroring everything server A had in a folder I called SRC. This process happens over SSH so it is rather secure to any prying eyes. However if you are thinking that this is some sort of a backup solution you would be wrong. Think about this in terms of two disk RAID1 but on a file level (and yes you can have a 3 disk RAID1... looking at you mdadm). Keep in mind that this solution does come with certain caveats that you need to be aware of. If you remove a file on server A than that file will be removed from server B. If you modify a file on server B it will not synchronize the file to server A. This tool is not designed to keep both ends the same, so kinda a RAID1 🙂 Saying that it has been performing really well and I did do some tests on some rather bigger linux distribution image (.iso) files. To push it a level up I decided to unplug and plug back in the network cable several times when I seen the increased activity due to the synchronization happening just to see how it would behave and will It resume (or go another round) when the connection is re-established. It all managed perfectly and I did some md5 checksums just to be sure that the files are identical on both servers. The only advice I could give to anyone based on my short exposure to lsyncd would be to add the "--inplace" parameter. This will save you on some bandwidth (copying only the differences over) especially when you are dealing with small changes in bigger files.
The last thing that comes to my mind is: will I ever use lsyncd for anything? I honestly have no idea. At the moment I struggle to find a use case for it. Maybe there are people / businesses out there that need to have a "live" copy of the files from a PC / production server. Or they just want to use it as a tool to aid them with the backup routine... I am sure there is someone out there that would make a use out of this, but that person ain't me at the moment.