Rsync through service synchronization, Linux system logs and screen tools

Source: Internet
Author: User
Tags rsync

Rsync syncs through services

Using service synchronization requires the Rsync--daemon service to be turned on, and the listening port (which is 873 by default and the port can be customized) is turned on and the client can communicate through this port and the server.
Format:
rsync -av test1/ 192.168.71.131::module/dir

Small experiment
Two machines:
A machine: 192.168.71.131 (service side)
B Machine: 192.168.71.132 (client)
Need to synchronize the B machine's files to the A machine

You need to edit the configuration file before you start the service/etc/rsyncd.conf you can write somewhere else, but if you write somewhere else, you need to specify the path after the rsync--daemon.

A example of a machine editing profile format: (Paste it into the/etc/rsyncd.conf)

port=873log file=/var/log/rsync.logpid file=/var/run/rsyncd.pidaddress=192.168.71.131[test]path=/tmp/rsyncuse chroot=truemax connections=4read only=nolist=trueuid=rootgid=rootauth users=testsecrets file=/etc/rsyncd.passwdhosts allow=192.168.71.132

Go to edit/etc/rsyncd.conf (we change the root behind path to TMP, and then create a/tmp/rsync directory ourselves and change the permissions to 777, so that it is easy to operate)

vi /etc/rsyncd.conf

Another line paste the content we copied, and then save the exit

A machine start-up service
rsync --daemon

See if it starts
ps aux |grep rsync

Pre-prep work is done and you can start synchronizing files
Copy files from the local machine to the remote rsync server. The mode is started when the DST path information contains the "::" delimiter
rsync [OPTION] ... SRC [[Email protected]]host::D EST
The B machine executes the following command:

Back up the/tmp/1.txt file on the B machine to the remote a machine and rename it to 1.23.txt (test is the name of the module, which is the name of the curly brace that we just added to the config file, and this module name represents the path we just changed/tmp/rsync)
rsync -avP /tmp/1.txt 192.168.71.131::test/1.23.txt

An error has occurred, check whether the network is connected, and whether the port can ping
Check if the network is connected

Check if the port can be used

Port does not pass, we check whether to deactivate the FIREWALLD service, if not quite need to use as below to stop (both the client and the server to stop)
systemctl stop firewalld

We need to enter the password when synchronizing, because we add to the configuration file line in two lines is about the password, we can put the following two lines in front of the number, so that synchronization can not lose the password. (Auth Users=test Secrets file=/etc/rsyncd.passwd)

Then we pull the file from the server to the client

Rsync through service synchronization, Linux system logs, and screen tools

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.