However, I don't use rsync for my day-to-day backups. Rsync sounds pretty awesome, and it really is worth your time to check it out. That's a humongous difference, and it's the main reason that rsync is so darn efficient. When you run rsync today, it doesn't copy over 10 MB instead, it copies over 1 kb, just the parts that you changed. Today, you opened that document and made a slight correction. Think about it: you originally copied over a large document that was 10 MB. Why? Because this time, rsync only copies over any bytes that have changed. You run the same rsync command, but this time the process is over in a fraction of the time it took the day before. The next day, after working on several different files throughout the day, you wish to repeat the process. You run rsync, and soon (depending on the amount of data you're copying), your home directory is now safely copied to your server. You configure rsync so that /home/username is your source directory, and /mnt/server is your destination. The server is mounted, using Samba, to /mnt/server. Here's an example: let's say you want to backup your home directory-at /home/username-to a server on your network. Rsync is software that performs a one-way synchronization. However, rsync, while absolutely excellent, is not the best software to use for backup.īefore I explain further, it's important to understand what rsync is and how it works, because that will help me justify my statement above. ![]() Rsync was developed by Andrew Tridgell, the same man behind Samba in fact, Tridge has stated that he believes that he'll be remembered through posterity for rsync far more than for Samba, and he just may be right. If a user new to Linux starts asking more experienced users about a good way to backup her data, she will soon hear about a wonderful tool named rsync. Type the following command for incron installation: sudo apt-get install incronĬonfigure the /etc/incron.allow file in order to allow user to use incron: sudo nano /etc/incron.The materials on this page are under a Attribution-ShareAlike Creative Commons license. add a new file, delete a file etc) and executes the command or scripts.It's usage is generally similar to cron. Make the unison to run every 30 min automatically: */30 * * * * unison -batch /var/How To Call unison On Demand?įor this, we need to install the incron(inotify cron daemon) which monitors filesystem events (e.g. Run unison again on PrimarySrv for sync: unison -batch /var/Verify the synchronization status on PrimarySrv:Įdit the crontab file to make the sychronization process automatically: crontab -e Use this command to verify that the local unison client can start and connect to the remote server(In this case,remote server's ip address is 192.168.1.203): unison -testServer /var/Now, try to sync with the remote server with the -batch (batch mode) option ask no questions at all: unison -batch /var/Create a sample file inside the /var/Verify the /var/www/ directory on SecondarySrv:įor two-way synchronization verification, create a file on SecondarySrv with the name " server2" inside the /var/www/ directory: sudo touch server2 ![]() Now, issue this command for the installation of unison on both server: sudo apt-get install unison Now,try to connect to SecondarySrv from PrimarySrv, and this time, it will not ask for the password ssh ssh directory with 700 permissions and try to append the public key to authorized_keys once again: ssh directory for this user (this user has never used ssh before). We got an error saying " ~/.ssh/authorized_keys: No such file or directory" it means that there is no. This tutorial shows how to set up file synchronization between two Ubuntu 12.04 servers with Unison that are on the same network but you can use the same approach on the servers that are not placed on the same network.īefore installing the unison,generate the ssh key pair on PrimarySrv and copy the public key to the SecondarySrv: ssh-keygen scp ~/.ssh/id_rsa.pub :Ĭonnect to the SecondarySrv, append the public key to authorized_keys: cat id_rsa.pub > ~/.ssh/authorized_keys It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other. Unison is a file-synchronization tool for Unix and Windows. File Synchronization Between Two Ubuntu Servers using Unison
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |