Spotlight | Reviews | Current Issue | Academy | Newsletter | Subscribe | Shop |
Departments

Yatego Shopping
Yatego International
Germany's Shoppingmall No.1! 10000 Shops and over 3,4 Mio. Products. Computer, Software and Technic Guidebooks.

user friendly

Admin Magazine

ADMIN Network & Security

Subscribe now and save!

ADMIN - Explore the new world of system administration! Special introductory offer! Order by September 30th to save 10% off the regular subscription price! Each issue delivers technical solutions to the real-world problems you face every day. Learn the latest techniques for better:

  • network security
  • system management
  • troubleshooting
  • performance tuning
  • virtualization
  • cloud computing

 

on Windows, Linux, Solaris, and popular varieties of Unix.

http://www.admin-magazine.com/

  linuxpromagazine.com » Online » Blogs » Productivity Sauce » Live Sync with lsyncd  

Productivity Sauce
Productivity Sauce

Live Sync with lsyncd

rsync is an excellent and versatile backup tool, but it does have one drawback: you have to run it manually when you want to back up your data. Sure, you can use cron to create scheduled backups, but even this solution cannot provide seamless live synchronization. If this is what you want, then you need the lsyncd tool, a command-line utility which uses rsync to synchronize (or rather mirror) local directories with a remote machine in real time. To install lsyncd on your machine, download the latest .tar.gz archive from the project's Web site, unpack it, and use the terminal to switch to the resulted directory. Run then the ./configure command followed by make, and make install (the latter command requires root privileges). lsyncd is rather straightforward in use, as it features just one command and a handful of options. The lsyncd command requires only two parameters: the source and the target directory, for example:

lsyncd /path/to/source /path/to/target

This command syncs two local directories, but lsyncd can also mirror a local directory to a folder on a remote machine. For example, the following command syncs the source directory on the local machine with the target directory on a remote machine which has the 192.168.1.7 IP address, connecting to the remote server as the user "monkey":

lsyncd /path/to/source monkey@192.168.1.7:/path/to/target/

In most cases, you have to provide a password to successfully connect to a remote server, so to make the command above work, you have to use the --no-daemon option which prevents the process from running as a daemon:

lsyncd --no-daemon /path/to/source monkey@192.168.1.7:/path/to/target/

Another useful option is --exclude. As the name suggests, it allows you to specify files or directories that you don't want to sync.

Comments

Live Sync with lsyncd

Dmitri Popov Nov 09, 2008 7:50pm GMT

Sounds like a cool tool, I wonder how many people use rsync-like tools against SPOF,
be it sysadmins or home users. We use tar as a basis for our own backup script,
but I recognize the power of rsync as a basis.
Also, there's so many tools to choose from, and I guess rsync tools can mix,
e.g. you can have lsyncd running, while also having a tool like rsyncBackup or
Rdiff-backup ?
Don't forget to make backups for databases (MySQL for example) with their tools, though,
to keep databases consistent!
Anyway, I like tools based on proven and mature simple Un*x tools like tar and rsync,
cause you'll also have all other Un*x tools to mix with them, e.g. being able to keep a cron
job separate from your backup program itself keeps things manageable.

Mike

Print this page. Recommend
Share