tourmeister
Active member
Here is the actual article I followed,
How To Mirror Local and Remote Directories on a VPS with lsyncd | DigitalOcean
While administrating web and application servers, there are many times when it is useful to mirror directories. The lsyncd service can mirror local and remo…www.digitalocean.com
I did have to ask my hosting service to install lsyncd on my VPS, which they did in a matter of minutes.
It took me about five minutes to go through the setup process. the only difference is that in that article, it mentions a conf file here
Code:/etc/lsyncd/lsyncd.conf.lua
when the actual conf file should be here,
Code:/etc/lsyncd.conf
and here are the necessary contents of the conf file,
Code:sync { default.rsyncssh, source="/sourcedir", host="remote_ip_address", targetdir="/targetdir" } settings {logfile = "/var/log/lsyncd/lsyncd.log", statusFile = "/var/log/lsyncd/lsyncd.status" }
It is running now and making a full uncompressed copy of my live site to my other VPS (which I wasn't using for anything, but which I have for another 2-1/2 years before my contract expires). Now, if I add any files anywhere on my site, they are automatically copied to the remote VPS. When users upload attachments, they are automatically copied to the remote VPS. If I install an add-on, the files are automatically copied to the remote VPS.
The nice thing is that once I have a full copy of everything transferred to the remote VPS, only new files will get transferred after that. So there is the initial big transfer and afterward just small transfers that don't hit my bandwidth real hard like a big backup of everything would do.
I use the add-on only to do nightly backups of the database and then to copy them to the remote VPS. I have it set to retain seven copies.
So I found out that PRIOR to starting the lsyncd, you need to first do a manual rsync to get the existing content of all directories onto the remote server if they don't already exist there. Once that is done, any new files will be transferred by the lsyncd. If you start with an empty remote server and go straight to lsyncd, only files created from that point on will be transferred to the remote server. Other than that, it works great.