Rsync Summary Note-transfer data in daemon (socket) mode

Source: Internet
Author: User

Topology:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/79/80/wKiom1aTEe-hFc0SAAA65XLNtR8021.png "title=" rsync topology map. png "alt=" Wkiom1atee-hfc0saaa65xlntr8021.png "/>

Server-side configuration: Rsync's configuration file is /etc/rsyncd.conf. Note that this file does not exist by default and needs to be created manually.

Here is a well-configured rsyncd.conf

##### #rsyncd. conf#######

uid = rsync---- à non-system virtual users

GID = rsync

Use chroot =no- à prevent security issues from occurring

maxconnections =-- à Maximum number of connections

Timeout =-- à Timeout period

pid File =/var/run/rsyncd.pid-- à the file where the process PID resides

lock File =/var/run/rsync.lock- à Lock

log file =/var/log/rsyncd.log- à log file with error

[Zhaofan]-- à Module

Path =/zhaofan/ à can be understood as a shared directory

Ignore errors-- à Ignore Errors

Read Only =false

list = false- à whether to allow list

hosts allow =192.168.1.0/24-- à allowed hosts

Hosts Deny =0.0.0.0/32

Auth users =rsync_backup- à Virtual User

Secrets file=/etc/rsync.password- à user-corresponding password file

###### #rsyncd. config########

The above is the configuration of the configuration file

Start the rsync service process:Rsync–daemon

Rsync the port is:873

[[Email protected] ~] #rsync--daemon

[[Email protected] ~] #netstat-lntup|grep 873

tcp         0     0 0.0.0.0:873                 0.0.0.0:*                    listen      27933/rsync         

TCP 0 0::: 873:::* LISTEN 27933/rsync

[[Email protected] ~] #cat/var/log/rsyncd.log

2016/01/0912:03:39 [27933] RSYNCD version 3.0.6 starting, listening on port 873

[Email protected] ~]#

[Email protected] ~]#

Actions required after the service starts:

[[email protected]/] #ls-DL Zhaofan

Drwxr-xr-x. 2root root 4096 Jan 9 12:06 Zhaofan

[Email protected]/]# useradd rsync-s/sbin/nologin

[Email protected]/]# chown-r rsync.rsync/zhaofan

[Email protected]/]# LS-DL Zhaofan

Drwxr-xr-x. 2rsync rsync 4096 Jan 9 12:06 Zhaofan

[Email protected]/]#

[[email protected]/] #echo "rsync_backup:zhaofan" >/etc/rsync.password

[Email protected]/]#

Here rsync_backup rsync's virtual user name,zhaofan is the password for Rsync's virtual username

[[email protected]/] #chmod /etc/rsync.password

[[email protected]/] #ls-dl/etc/rsync.password

-RW-------. 1root Root 9 12:10/etc/rsync.password

Also need to turn off Selinx and firewalls

All of the above server configurations are configured.

Here is the client configuration

echo "Zhaofan" >/etc/rsync.password

[[Email protected] ~] #chmod /etc/rsync.password

So far, all the configurations have been configured.

Note: The rsync command must be operated on the client.

Access via remote shell:

Pull:rsync [OPTION ...] [[email protected]] Host:src ... [DEST]

Push:rsync [OPTION ...] Src... [[email protected]] Host:dest

Access via rsync daemon:

Pull:rsync [OPTION ...] [[email protected]] Host::src ... [DEST]

rsync [OPTION ...] rsync://[[email protected]]host[:P ort]/src ... [DEST]

Push:rsync [OPTION ...] Src... [[email protected]] HOST::D EST

rsync [OPTION ...] Src...rsync://[[email protected]]host[:P Ort]/dest

Validating pull results on the client

[[email protected]/] #rsync-avz [email protected]::zhaofan/data

Password:

Receivingincremental file List

./

A

B

C

D

E

F

G

Sent 207bytes received 413 bytes 248.00 bytes/sec

Total size IS7 speedup is 0.01

[Email protected]/]#

The following is a push to the server

[[Email protected]]# touch {1..10}

[Email protected]]# ls

1 2 3 4 5 6 7 8 9 a B c D E F g

[Email protected]]# rsync-avz/data/[email Protected]::zhaofan

Password:

Sendingincremental file List

./

1

10

2

3

4

5

6

7

8

9

Sent 536bytes received 201 bytes 294.80 Bytes/sec

Total size IS7 speedup is 0.01

[[Email protected]]#

If you do not want to enter the password in the process method:

[Email protected]]# rsync-avz [email protected]::zhaofan/data --password-file=/etc/rsync.password

Receivingincremental file List

./

10

11

12

13

14

15

Sent 182bytes received 590 bytes 1544.00 bytes/sec

Total size IS7 speedup is 0.01

[[Email protected]]#

So you don't have to enter a password in the process.


This article is from the "8703732" blog, please be sure to keep this source http://8713732.blog.51cto.com/8703732/1733650

Rsync Summary Note-transfer data in daemon (socket) mode

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.