Rsync service establishment

Source: Internet
Author: User
Tags inotify

Rsync is a very convenient remote data backup tool, and its advantages will not be described in detail. You can refer to Baidu. Given the powerful features of Rsync, we need to learn about it, next we will build a simple rsync service to illustrate how rsync synchronizes data.

1. Check whether the software is installed.

[Root @ svr1 ~] # Rpm-q rsync

Rsync-3.0.6-4.el5_7.1 ...... Software Installed

2. Create an Rsync User File

[Root @ localhost ~] # Vim/etc/rsyncd_users

Stu01: 123

Stu02: 456

Stu03: 789

~

3. Configure security permissions for User Files

[Root @ svr1 ~] # Chmod 600/etc/rsyncd_users ...... Only allow users to read and write files by themselves. This step cannot be omitted.

4. Create a configuration file

[Root @ svr1 ~] # Vim/etc/rsyncd. conf

Uid = nobody

Gid = nobody

Use chroot = no

Log file =/var/log/rsyncd. log

Pid file =/var/run/rsyncd. pid

[Tools]

Path =/usr/src

Comment = welcome to Rsync

Read only = yes

Auth users = stu01, stu02, stu03

Secreats file =/etc/rsyncd_users

~

~

5. enable the Service

[Root @ svr1 ~] # Rsync-daemon

[Root @ svr1 ~] #

6. View service processes

[Root @ svr1 ~] # Ps-ef | grep rsync

Root 5253 1 0 19: 45? 00:00:00 rsync -- daemon

Root 5276 4866 0 00:00:00 pts/2 grep rsync

7. Verify on the client

[Root @ localhost ~] # Rsync stu01@192.168.10.11: tools

Password:

Drwxr-xr-x 4096 09:30:27.

Drwxr-xr-x 4096 19:58:23 debug

Drwxr-xr-x 4096 09:25:34 kernels

Drwxr-xr-x 4096 09:30:27 RedHat

[Root @ localhost ~] # Ll/rsync/

Total 12

Drwxr-xr-x 2 root 4096 2011-05-11 debug

Drwxr-xr-x 3 root 4096 03-05 09:25 kernels

Drwxr-xr-x 7 root 4096 03-05 09: 30 redhat

8. Because Rsync is not a boot item by default, if you need to set Rsync as the boot service, you can write the rsync-daemon command to the/etc/rc. local file to enable the startup.

9. Common rsync parameters:

View local/remote file attributes in rsync files or directories/remote host files

Download: rsync user @ host: local directory of the source directory (download synchronization must have the permission to read the SSH source)

Upload: rsync local directory user @ host: target directory (the upload synchronization must have the write permission on the SSH source)

 

Rsync:

-- Delete-excluded: delete Files specified by this option at the receiving end.

-A archive mode: Transfers files recursively and maintains all file attributes.

Rsync details: click here
Rsync: click here

Recommended reading:

Monitor host files and directories using inotifywait

Using inotify + rsync for Linux File batch update

Inotify-tools + rsync real-time file synchronization installation and configuration

Complete rsync synchronization Configuration

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.