Rsync+ssh Sync, Rsync+rsync sync

Source: Internet
Author: User
Tags rsync

1.RSYNC: Remote sync, support local replication, or synchronize with other SSH and RSYNC hosts.

Rsync remote synchronization and CP, SCP function basically consistent, the other two is to copy the source files, if there is new data added, using CP, SCP to the source file all the content is copied, and Rsync is on the basis of the source files only update the newly changed data.

2. Synchronization and Replication differences:

Copy: Full copy source to target.

Synchronous: Incremental copy that transmits only changed data.

Basic operation of 3.rsync synchronization

Use format: Rsync source Document Destination document

Rsync Common Options
-A: Archive mode, equivalent to-rlptgod
-V: Show synchronization process details
-Z: Compression enabled during transfer
-H: Keep Hard connection files
-A: Preserve ACL attribute information for a file
--delete: Delete a file with a target but no source
Lab Environment:

Server ip:192.168.1.20 host Name: FANLJ

Remote host ip:192.168.1.30 host name: localhost

Experiment (I.)

Experimental purpose: centos6.5 based on rsync + sshd server upload, download

downlink: rsync [email protected]: Source directory local Directory
Upstream: rsync local directory [email protected]: target directory

1. Backing up the remote host's/boot/directory to a local directory/fromssh,/fromssh directory can be implemented without a presence.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/66/wKioL1XjF3qyXZ9sAACYW2tPi2o529.jpg "title=" Qq20150830224045.png "alt=" Wkiol1xjf3qyxz9saacyw2tpi2o529.jpg "/>

Whether the local test was successfully downloaded

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/6A/wKiom1XjFhzgg_mQAAHP_B-Gbdo774.jpg "title=" Qq20150830224401.png "alt=" Wkiom1xjfhzgg_mqaahp_b-gbdo774.jpg "/>

2. Back up the local/etc/directory to the remote host

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/66/wKioL1XjF_XgXtlaAACbx-GLaNM292.jpg "title=" Qq20150830224251.png "alt=" Wkiol1xjf_xgxtlaaacbx-glanm292.jpg "/>

Whether the remote host test was uploaded successfully

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/6A/wKiom1XjFnnhGAJaAABfKYcnaIA689.jpg "title=" Qq20150830224533.png "alt=" Wkiom1xjfnnhgajaaabfkycnaia689.jpg "/>

Experiment (II)

Experimental purpose: CentOS based rsync client + rsync server
(downlink: rsync [email protected]:: Shared name local directory)
(Upstream: rsync local directory [email protected]:: Share name)

Service-Side requirements:

The remote host needs to run the Rsync service mode (--daemon)

Specify a folder and set up a sync share

Enable user authentication (or allow anonymous access) as needed

1. Release the rsync--daemon share

Create a sync account file user name Ruser password pwd123 (each action user one record)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/67/wKioL1XjJZuR_9WkAABwJoLVBH0098.jpg "title=" Qq20150830234053.png "alt=" Wkiol1xjjzur_9wkaabwjolvbh0098.jpg "/>

Set permissions on a file, or synchronization will fail

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/6B/wKiom1XjJE3CAvSpAABZ8lPSsFs055.jpg "title=" Qq20150830234430.png "alt=" Wkiom1xjje3cavspaabz8lpssfs055.jpg "/>
Setting up/etc/rsync.conf sharing settings

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/6B/wKiom1XjJObxLKWZAAEZE2L7vto016.jpg "title=" Qq20150830234701.png "alt=" Wkiom1xjjobxlkwzaaeze2l7vto016.jpg "/>

    path =/usr/src                                     shared path
    comment = Rsync Share test             description Information
    Read Only = yes                                    is a read-only
    dont Compress = *.gz *.bz2 *.tgz *.zip    do not need to package
    auth users = Ruser   &nbs P          //who is allowed to access
    Secrets file =/etc/rsyncd_users.db  & nbsp;       //Specify the path to the account file

Start the rsync--daemon service

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/6B/wKiom1XjJbXwgC3zAAD91YxxotI059.jpg "title=" Qq20150830235032.png "alt=" Wkiom1xjjbxwgc3zaad91yxxoti059.jpg "/>

Download test for 2.rsync + rsync server

On the client side of the test, the client View server has those rsync shares

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/6B/wKiom1XjJl3BckZWAABa0Mdmu2k456.jpg "title=" Qq20150830235229.png "alt=" Wkiom1xjjl3bckzwaaba0mdmu2k456.jpg "/>

Browse Rsync Shared Content

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/68/wKioL1XjKYuxmvv7AAEhNCm9MR4782.jpg "title=" Qq20150830235729.png "alt=" Wkiol1xjkyuxmvv7aaehncm9mr4782.jpg "/>

Download content for rsync share

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/68/wKioL1XjKo-R46XmAAFS0BXLx1I645.jpg "title=" Qq20150831000211.png "alt=" Wkiol1xjko-r46xmaafs0bxlx1i645.jpg "/>

Experiment (III)

Experimental Purpose: Site Directory mirroring synchronization
Experimental requirements:
1. Configuring Rsync sharing on FANLJ
1) shared folder path:/var/www/html/
2) share named Webroot
3) The user name of the license is Wuser, password Taren1
2. Perform synchronization on localhost
1) Local destination folder:/var/www/html/
2) Auto-sync every 2 hours

Server FANLJ Configuration

Create a sync account file user name Wuser password Taren1 (each action user one record)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/68/wKioL1XjLvKjZHl1AABby45Yk70910.jpg "title=" Qq20150831002046.png "alt=" Wkiol1xjlvkjzhl1aabby45yk70910.jpg "/>

Setting up/etc/rsync.conf sharing settings

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/68/wKioL1XjMdugpEs3AAD73lBzWq8909.jpg "title=" Qq20150831003305.png "alt=" Wkiol1xjmdugpes3aad73lbzwq8909.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/72/6C/wKiom1XjLSmx_PbKAABYXf4vbXQ640.jpg "title=" Qq20150831002215.png "alt=" Wkiom1xjlsmx_pbkaabyxf4vbxq640.jpg "/>


Testing on the client

Creating a password file is a user's access without the need to enter a password to interact.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/6C/wKiom1XjLbPAV2zwAACY7-NBlqg971.jpg "title=" Qq20150831002357.png "alt=" Wkiom1xjlbpav2zwaacy7-nblqg971.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/68/wKioL1XjL_TgJ9_kAABP5cwOTzE520.jpg "title=" Qq20150831002514.png "alt=" Wkiol1xjl_tgj9_kaabp5cwotze520.jpg "/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/6C/wKiom1XjLnOzeGitAACVEvXuNCM779.jpg "title=" Qq20150831002739.png "alt=" Wkiom1xjlnozegitaacvevxuncm779.jpg "/>



This article is from the "Down to earth" blog, make sure to keep this source http://343614597.blog.51cto.com/7056394/1690015

Rsync+ssh Sync, Rsync+rsync sync

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.