Rsync.conf detailed

Source: Internet
Author: User

1. Edit the configuration file on the server side
    1. [Email protected]_intf ~]# more/etc/rsyncd.conf
    2. port=8730
    3. Log File=/var/log/rsync.log
    4. PID File=/var/run/rsync.pid
    5. [ABC]
    6. Path=/tmp/123
    7. Use Chroot=yes
    8. Max Nonections=4
    9. Read Only=yes
    10. List=yes
    11. Uid=root
    12. Gid=root
    13. Auth USERS=ABC
    14. Secrets file=/etc/rs.passwd
Copy Code Description:
configuration file/etc/rsyncd.conf, with the following content:
#port the =873 #监听端口默认为873, or it could be another port.
Log File=/var/log/rsync.log #指定日志
pid file=/var/run/rsyncd.pid #指定pid
#address =192.168.0.10 #可以定义绑定的ip
The above section is the Global configuration section, the following are the settings within the module
[ABC] #为模块名, custom
path=/tmp/123 # Specifies which directory the module corresponds to
Use Chroot=true # is limited to this directory, the default is true, when there is a soft connection, you need to change to Fasle, if true is limited to the module default directory
Max connections=4 # Specifies the maximum number of clients that can be connected
Read Only=no # is read-only, if no, the customer service side to push to the server when unsuccessful, this time to change to Yes
list=true #是否可以列出模块名 rsync--port 8730 172.16.37.139:: If yes, all the module names of the client are listed.
uid=root #以哪个用户的身份来传输
gid=root #以哪个组的身份来传输
Auth users=test #指定验证用户名, can not set, do not set the default password, set the word security higher
Secrets file=/etc/rsyncd.passwd #指定密码文件, if you set the authentication user, this item must be set, the password permission is set to three.
hosts allow=192.168.0.101 #设置可以允许访问的主机, can be a network segment, multiple IP addresses are separated by spaces
the content format of the password file/etc/rsyncd.passwd is: Username:password
the command to start the service is: rsync--daemon
The default is to use/etc/rsyncd.conf This configuration file, you can also specify the configuration file rsync--daemon--config=/etc/rsyncd2.conf, change the configuration file without restarting the service, immediate effect.

2, the client to save the password file permissions on the server is 400 for the script to use.
    1. [Email Protected]_app ~]# More/etc/123.pass
    2. abc123
Copy Code 3, the client's 123 file under the content of the server, which is the service side of the read-only to change to No, or the upload is unsuccessful.
    1. [Email protected]_app ~]# rsync-avpz--port 8730 123/--password-file=/etc/123.pass [email protected]::abc
    2. Sending incremental file list
    3. ./
    4. Anaconda-ks.cfg
    5. 1338 100% 0.00kb/s 0:00:00 (xfer#1, TO-CHECK=1/3)
    6. Install.log
    7. 49733 100% 11.86mb/s 0:00:00 (xfer#2, TO-CHECK=0/3)
    8. Sent 12379 bytes received bytes 24856.00 bytes/sec
    9. Total size was 51071 speedup is 4.11
Copy Code 4, view the server's module name on the client, no password required
    1. [[Email Protected]_app ~]# rsync--port 8730 172.16.37.139::
    2. Abc
Copy Code 5, server does not need to synchronize to the client's files, plus--exclude=filename
    1. [Email protected]_intf 123]# rsync-avzp--exclude=install.log--exclude=2/tmp/123/[email protected]:/home/itv/123
    2. [email protected] ' s password:
    3. Sending incremental file list
    4. ./
    5. 3231231
    6. 0 100% 0.00kb/s 0:00:00 (xfer#1, TO-CHECK=3/5)
    7. Anaconda-ks.cfg
    8. 1338 100% 0.00kb/s 0:00:00 (xfer#2, TO-CHECK=2/5)
    9. As
    10. 0 100% 0.00kb/s 0:00:00 (xfer#3, TO-CHECK=1/5)
    11. ppppppp/
    12. Sent 1057 bytes received bytes 151.07 bytes/sec
    13. Total size was 1338 speedup is 1.18
Copy Code 6, rsync parameter options in detail.
    1. -A,--archive archive mode, which means to transfer files recursively and keep all file attributes equal to-rlptgod
    2. -R,--recursive subdirectories in recursive mode
    3. -L,--links reserved Soft link
    4. -P,--perms maintain file permissions
    5. -T,--times keep file time information
    6. -O,--owner keep file owner information
    7. -G,--group keep file group information
    8. -D,--devices keep device file information
    9. --delete Delete those files that are not in the DST Src. Will delete the documents not in the destination document.
    10. --delete-excluded also deletes those files that are excluded by the option specified by the Receive side
    11. --delete-after transfer ends after removal
    12. --exclude=pattern specify to exclude file modes that do not need to be transferred
    13. -P equals--partial--progress shows the backup process
    14. -U,--update only updates, that is, skipping all the files that already exist in DST, and the file time is later than the file to be backed up, not overwriting the updated file
Copy Code 7,
A, if the end of the machine is not the default port 22, the synchronization time to add-E "ssh-p Port"
    1. [Email protected]_intf 123]# rsync-avzp-s "ssh-p"/tmp/123/[email protected]:/home/itv/123
Copy Code B, if you are creating a key pair, the machines trust each other and need to add"--rsh=ssh-p Port"
rsync-av "--rsh=ssh-p port"/dir1/192.168.0.101:/tmp/dir2/

Rsync.conf detailed

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.