Rsync, the latest data image backup tool in Linux

Source: Internet
Author: User
Tags man rsync

1. What is rsync?

Rsync, remote synchronize is a software that implements remote synchronization. It can keep the permissions, time, soft and hard links, and other additional information of the original file while Synchronizing files. Rsync uses the "rsync algorithm" to provide a fast way to synchronize files between clients and remote file servers. It can also transmit files through ssh, which ensures high confidentiality, in addition, it is free software.

Rsync includes the following features:

Update the entire directory and tree and file system;
Optional maintenance of symbolic chains, hard links, files belonging to, permissions, devices, and time;
No special permission requirements are required for installation;
For multiple files, the internal pipeline reduces the latency of file waiting;
You can use rsh, ssh, or direct port as the transfer port;
Supports anonymous rsync file synchronization and is an ideal image tool;

2. rsync installation. Common method: yum install rsync

3. configuration file of rsync server

[Plain] view plaincopy
  1. Cat/etc/rsyncd/rsync. conf

  2. # Distributed under the terms of the GNU General Public License v2

  3. # Minimal configuration file for rsync daemon

  4. # See rsync (1) and rsyncd. conf (5) man pages for help

  5. # This line is required by the/etc/init. d/rsyncd script

  6. Pid file =/var/run/rsync. pid

  7. Port = 873

  8. # Address = 192.168.1.171

  9. # Uid = nobody

  10. # Gid = nobody

  11. Uid = root

  12. Gid = root

  13. Use chroot = yes

  14. Read only = no

  15. # Limit access to private LANs

  16. Hosts allow = *

  17. # Hosts deny = *

  18. Max connections = 5

  19. Motd file =/etc/rsyncd/rsync. motd

  20. # This will give you a separate log file

  21. # Log file =/var/log/rsync. log

  22. # This will log every file transferred-up to 85,000 + per user, per sync

  23. # Transfer logging = yes

  24. Log format = % t % a % m % f % B

  25. Syslog facility = local3

  26. Timeout = 300

  27. [Data]

  28. Path =/data1

  29. List = yes

  30. Ignore errors

  31. Auth users = root

  32. Secrets file =/etc/rsyncd/rsync. secrets

  33. Comment = rsync data1 dir

  34. # Exclude = beinan/samba/

  35. [Garbagekrc]

  36. Path =/data1/garbagekrc

  37. List = yes

  38. Ignore errors

  39. Auth users = root

  40. Secrets file =/etc/rsyncd/rsync. secrets

  41. Comment = rsync garbagekrc dir

User Password File:

[Plain] view plaincopy
  1. Cat/etc/rsyncd/rsync. secrets

  2. Root: test123

The username must be an existing user on the server.
4. Start the rsync service:/usr/bin/rsync -- daemon -- config =/etc/rsyncd/rsync. conf

5. Back Up Files to the server:

Rsync-az -- password-file = rsync. password jsoncpp/* root @ IP: data/mydata/

Password-file can specify the password.

6. rsync can also pull files from the server to the local device. You can use crontab to implement timed synchronization.

7. For more information, see man rsync.


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.