Installation of rsync under Linux and configuration of remote server data synchronization

Source: Internet
Author: User
Tags rsync

The data in the server is the most important, the data of commercial use is more important, once lost, the result is unimaginable. So backup is important. Can be used to Rsync+crontab to do data synchronization.


Method/Step
  1. The first is the installation

    wget http://rsync.samba.org/ftp/rsync/src/rsync-3.1.0.tar.gz

    CD rsync-3.1.0/

    ./configure--prefix=/usr/local/rsync

    Make

    Make install

  2. Under test

    Make Test

    No problem

  3. Start the configuration below, note that the default is no rsyncd.conf file, you need to manually create

    The following is the contents of the file, such as

    UID = root

    GID = root

    Use chroot = no

    Max connections = 4

    PID file =/var/run/rsyncd.pid

    Lock file =/var/run/rsync.lock

    Log file =/var/log/rsyncd.log

    [logs]

    Path =/mnt/hgfs/code/test

    Ignore errors

    Read Only = True

    List = False

    Hosts allow = 192.168.1.200

    Auth users = root

    Secrets file =/etc/backserver.pas

  4. Configuring a password file (/etc/backserver.pas) is also required to manually create

    Vi/etc/backserver.pas

    root:123456789

    You need to modify the permissions of the file to 600, both the owner and the group are root

    Chown Root:root/etc/backserver.pas

    chmod 600/etc/backserver.pas

  5. /usr/bin/rsync--daemon

  6. First generate a password configuration file that needs to be consistent with the password on the source data server

    vim/etc/ Rsyncd.secretes (File not present, vi manually generated)

    chmod 600/etc/rsyncd.secretes

  7. 7

    Use Crontab to update daily 4 o'clock in the morning (this time the server pressure is slightly smaller)

    crontab-e00 * * * RSYNC-VZRTOPG--progress--delete--password-file=/etc/rsyncd.secretes [email protected]::logs/dat A/test

    This synchronizes the data from the remote server's/mnt/hgfs/code/test (configured within the/etc/rsyncd.conf of the source data server) to the/data/test under the remote server.

    You can view the scheduled tasks by Vi/var/spool/cron/username (if username is root and the path is/var/spool/cron/root).


Installation of rsync under Linux and configuration of remote server data synchronization

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.