Linuxrsync synchronous backup

Source: Internet
Author: User
Tags ssh port
Linuxrsync sync backup 1. rsync installation: rysnc official website: http: rsyncsambaorg. you can get the latest version from above. Sudoapt-getinstallrsync note: Online installation methods such as debian and ubuntu; yumin linux rsync synchronous backup 1. installation of rsync: official rysnc website: http://rsync.samba.org/ You can get the latest version from above. # Sudo apt-get install rsync note: Online installation methods such as debian and ubuntu; # yum install rsync note: Online installation methods such as Fedora and Redhat; # rpm-ivh rsync note: rpm Ora, Redhat rpm Package installation method; source package installation: tar xvf rsync-xxx.tar.gz cd rsync-xxx. /configure -- prefix =/usr; make install 2. the command formats of rsync can be as follows: rsync [OPTION]... src dest rsync [OPTION]... SRC [USER @] HOST: DEST rsync [OPTION]... [USER @] HOST: src dest rsync [OPTION]... [USER @] HOST: SRC DES T rsync [OPTION]... SRC [USER @] HOST: DEST rsync [OPTION]... rsync: // [USER @] HOST [: PORT]/SRC [DEST] corresponds to the preceding six command formats. rsync has six different working modes: 1) copy a local file. This mode is enabled when the SRC and DES paths do not contain a single colon ":" separator. 2) use a remote shell program (such as rsh and ssh) to copy the content of the local machine to the remote machine. This mode is enabled when the DST path address contains a single colon ":" separator. 3) use a remote shell program (such as rsh and ssh) to copy the contents of the remote machine to the local machine. This mode is enabled when the SRC address path contains a single colon ":" separator. 4) copy files from the remote rsync server to the local machine. This mode is enabled when the SRC path information contains the ":" separator. 5) copy files from the local machine to the remote rsync server. This mode is enabled when the DST path information contains the ":" separator. 6) list of remote machine files. This is similar to rsync transmission, but you only need to omit the local machine information in the command. 3. understanding rsync: rsync can be understood as building an ftp server on windows. it can have its own authentication username and password to log on to the client, which is irrelevant to the operating system account and password, the chroot command can be understood as a virtual directory. The rsync server, that is, the backup host, the client, that is, the backup host, or the backup server, is also called the backup server. The command has six formats, the last three methods involve the concept of rsync servers. if you want to use rsync servers, it is similar to setting up ftp, so you need to create a configuration file on the server and configure relevant information, which is complex and of little significance, not discussed in this article, you need to find information on your own online. you do not need to create a server in the second or second method of the command. it is implemented through the built-in file transfer function of ssh, which is simple and easy to use, this article focuses on this method. 4. instance (ssh port is not 22): rsync-e 'Ssh-p 100'-avr -- progress -- delete root@203.86.4.175: /u01/app // u01/app/ydtest/-- exclude = *. log * 5. parameter description:-v, -- verbose detailed mode output-q, -- quiet simplified output mode-c, -- checksum turn on the check switch, -a, -- archive mode is mandatory for file transfer, indicating that the file is transmitted recursively and all file attributes are kept, which is equal to-rlptgoD-r, -- recursive processes-R in recursive mode for subdirectories, -- relative uses relative path information-B, -- backup to create a backup, that is, when the target already has the same file name, rename the old file ~ Filename. You can use the -- suffix option to specify different backup file prefixes. -- Backup-dir: backs up files (for example ~ Filename) is stored in the directory. -Suffix = SUFFIX defines the backup file prefix-u. -- update only performs updates, that is, skipping all files that already exist in DST and whose file time is later than the backup time. (Do not overwrite the updated file)-l, -- links retains the soft link-L, -- copy-links: Process soft links like regular files -- copy-unsafe-links: only copies links other than the SRC path directory tree -- safe-links ignores the directory tree pointing to the SRC path other links-H, -- hard-links keep hard links-p, -- perms keep file permissions-o, -- owner keep file owner information-g, -- group keep file group Information-D, -- devices: Keep device file information-t, -- times: keep File time information-S, -- sparse performs special processing on sparse files to save DST space-n, -- dry-run which files will be transmitted-W, -- whole-file to copy files without incremental detection-x, -- one-file-system: do not span the file system boundary-B. -- block-size = SIZE indicates the block size used by the algorithm. the default value is 700 bytes-e, -- rsh = COMMAND specifies the use of rsh and ssh for data synchronization. It can also be used to specify the ssh port, for example, rsync-e 'Ssh-p 100' username @ hostname: sourceFile DestFile -- rsync-path = PATH specifies the path of the rsync command on the remote server-C, -- cvs-exclude automatically ignores the file in the same way as CVS, used to exclude files that do not want to be transmitted -- existing only updates files that already exist in DST, instead of backing up those new files -- delete those files that are not in the dst src -- delete-excluded also delete the files that are excluded by this option at the receiving end -- after the delete-after transmission ends delete -- ignore-errors and delete it when I/O errors occur in a timely manner -- max-delete = NUM delete a maximum of NUM files -- partial keep those files that are not completely transmitted for any reason, to accelerate the subsequent re-transmission -- force the deletion of directories, even if it is not blank -- numeric-ids does not match the number user and group ID as the user name and group name -- timeout = time ip timeout TIME, in seconds-I, -- ignore-times does not skip files with the same time and length -- size-only. when determining whether to back up a file, only check the file size, regardless of the file Time -- modify-window = NUM determines whether the file is time-stamped, the default value is 0-T -- temp-dir = DIR. create a temporary file in DIR -- compare-dest = DIR and compare the files in DIR to determine whether to back up-P is equivalent to -- partial -- progress displays the backup process-z, -- compress compresses the backup files during transmission -- exclude = PATTERN specifies to exclude the file mode that does not need to be transmitted -- include = PATTERN specifies the file mode to be transmitted without exclusion -- exclude- from = FILE exclude files in the specified mode -- include-from = FILE do not exclude files in the specified mode of FILE -- version Print version information -- address bound to a specific address -- config = FILE specify other configuration files, do not use the default rsyncd. conf file -- port = PORT specify other rsync service ports -- blocking-io for Remote shell use blocking IO-stats to give the transmission status of some files -- progress actual transmission process -- log -format = formAT specify the log file format -- password-FILE = FILE get the password from the file -- bwlimit = KBPS limit I/O bandwidth, KBytes per second-h, -- help displays help information
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.