Rsync Linux (Upper) __linux

Source: Internet
Author: User
Tags rsync rsync usage man rsync
"Linux" rsync usage

Rsync is the first to replace the RCP this directive, because rsync not only the speed of transmission, and he can transfer, compared to the local and remote host to copy the contents of the file, but only the difference between the two ends of the file, so the transmission time is relatively much lower. In addition, rsync can be transported in at least three different ways:

· It works directly on this machine and is almost exactly the same as CP, for example:

Rsync-av/etc/tmp (Backup of/etc/data to/TMP/ETC)

· Data transfer between server/client through rsh or SSH channels, for example:

RSYNC-AV-E ssh user@rsh.server:/etc/tmp (backup rsh.server/etc to/tmp of local host)

· It is transmitted directly through the services provided by rsync (daemon), when the rsync host needs to start 873 port:

1. You have to start rsync on the server side, see/etc/xinetd.d/rsync;
2. You must edit the/etc/rsyncd.conf profile;
3. You must set the client-side connection password data;
4. Available on client side: Rsync-av User@hostname::/dir/path/local/path

In fact three transmission modes differ in whether there is a colon (:) Only, the local-side transmission does not need a colon, through SSH or rsh, you have to use a colon (:), if it is through the rsync daemon, you need two colon (::), should not be difficult to understand.) Because the local side processing is very simple, and our system has to provide SSH service, so, under the bird brother will directly introduce the use of rsync through SSH to back up the action Oh. But let's take a look at the syntax of rsync.

Turn from: Http://linux.vbird.org/linux_server/0310telnetssh.php#rsync

1,rsync Syntax and Parameters

[Root@linux ~]# rsync [-avrlptgod] [e-SSH] [user@host:/dir] [/local/path]

Parameters:

-V: Observation mode, you can list more information;

-Q: Contrary to-V, quiet mode, the output of less information;

-R: Recursive system. Can be handled for "directory". Very important.

-U: Updates only (update), will not overwrite the target of the new file;

-L: Copy the properties of the link file, not the original file content of the linked object;

-P: When replicating, it is also saved with attributes (permission).

-G: Save the original file of the owning group;

-O: Save the owner of the original file;

-D: Appliance properties for saving original files (device)

-T: Save the time parameter of the original file;

-I: Ignoring the attributes of the update time (mtime), the file will be relatively fast;

-Z: plus the compressed parameters.

-e: Channel contracts used, for example, using the SSH channel, the-e ssh

-A: The equivalent of-rlptgod, so this-A is the most commonly used parameter.

For more information, refer to the man rsync explanation.

2, use rsync to back up the/ETC directory on the remote 37 to the local/tmp/bb directory.

[Root@kk ~] # rsync-av-e SSH 192.168.254.37:/etc/tmp/bb

The authenticity of host ' 192.168.254.37 (192.168.254.37) ' can ' t be established.

RSA key fingerprint is 67:aa:a3:19:b4:be:1f:64:e6:76:49:41:92:76:ef:7c.

Are you sure your want to continue connecting (yes/no)? Yes

warning:permanently added ' 192.168.254.37 ' (RSA) to the list of known hosts.

root@192.168.254.37 ' s Password:

。。。。。。

Sent 549296 bytes received 25779122 bytes 810105.17 bytes/sec

Total size is 82609812 speedup is 3.14

Note:-A keeps all attributes of the original file (this parameter is a combination of other parameters);

-V Displays details of the backup process

-e Specifies channel protocol, e-SSH connects remote 37 machine with SSH protocol

/tmp/bb the directory where backups are stored locally


3, the local/etc directory backup to the local/TMP/AA directory

The first time: can be understood as fully prepared.

[Root@nod1 peers]# rsync-av/etc//TMP/AA

Yum/yum-updatesd.conf

yum/pluginconf.d/

Yum/pluginconf.d/security.conf

Sent 89011933 bytes received 33008 bytes 6595921.56 bytes/sec

Total size is 88889417 speedup is 1.00

Second: Only differential backups are made. Efficiency is very high.

To add a ZBB file to the/etc/, and then back up.

[Root@nod1 peers]# rsync-av/etc//TMP/AA

Building file List ... done

./

ZBB//Oh, here only backup files that have been different since the last time. Efficiency is very high.

Sent 60946 bytes Received bytes 40666.67

Total size is 88889417 speedup is 1457.20


Related Article

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.