Rsync transmits backup data in a daemon way

Source: Internet
Author: User
Tags chmod rsync

This article describes the way rsync takes a daemon approach to data transfer backup, hoping to provide some help for learning about Rsync's children's shoes.

First, the environment

1, prepare two servers, one for the server side, one for the client side

2. Logic diagram

Ii. rsync server-side deployment

1. Check if rsync is installed

[[email protected]  ~]#  which  rsync/usr/bin/rsync

2, Configuration rsyncd.conf

Note:rsyncd.conf configuration file does not exist, we need to create it ourselves, the path is/etc/rsyncd.conf

[[email protected]  ~]# vim  /etc/rsyncd.confuid = rsyncgid = rsyncuse chroot = nomax connections = 200          timeout = 300             pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.log[oldboy]path =  /backup/ignore errorsread only = falselist = falsehosts allow = 192.168.1.0/24hosts deny = 0.0.0.0/32auth users = rsync_backup            secrets file = /etc/rsync.password  

3. Create a/etc/rsync.password file

Note:Rsync.password is a virtual account and password, and the account number is the Auth users in the/etc/rsyncd.conf configuration file = Rsync_backup

[[email protected] ~]#  echo “rsync_backup:123456”  >/etc/rsync.password[[email protected] ~]#  cat  /etc/rsync.passwordrsync_backup:123456[[email protected] ~]#  chmod  600  

remark:rsync_backup:123456 (rsync virtual user name: rsync virtual user password)

4. Start Rsync Service

[[email protected] ~]#  rsync --daemon[[email protected] ~]#  netstat -lntup|grep rsynctcp        0      0 0.0.0.0:873                 0.0.0.0:                   LISTEN      2844/rsync          tcp        0      0 :::873                                :::                        LISTEN      2844/rsync *

5. Create a system virtual user rsync

[[email protected] ~]# useradd rsync -s /sbin/nologin

6. Create a directory to be backed up/backup/

[[email protected] ~]# mkdir /backup[[email protected] ~]# chown  -R  rsync.rsync  /backup/

7. Close Iptables and SELinux

[[email protected] ~]#  /etc/init.d/iptables stop[[email protected] ~]#  

To this end, the server-side configuration is complete and the client side is configured next.

Third, rsync client-side deployment

Client side of the configuration is much simpler, first of all to have rsync software, followed by the password file configuration Rsync.password

1. Check if there is rsync

[[email protected] ~]#   which rsync/usr/bin/rsync

2. Create a Rsync.password file

[[email protected] ~]#  echo “123456”  >/etc/rsync.password [[email protected] ~]#  cat  /etc/rsync.password123456[[email protected] ~]#  chmod  600  /etc/rsync.password

Note:Only a password is required on the client side of the Rsync.password.

3. Testing

[[email protected] ~]# rsync -avz [email protected]::oldboy /home/receivePassword: receiving incremental file list./1.txt2.txtsent 105 bytes  received 218 bytes  92.29 bytes/sectotal size is 0  speedup is 0.00

File transfer success, I'm so happy!

Summarize:

1, server side and client side should have rsync software;

2, the rsync command must be executed on the client side, this is just learning rsync easy to ignore the place.

Rsync transmits backup data as a daemon

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.