Use Rsync automatic synchronization tool in Debian and Fedora

Source: Internet
Author: User
Linux (Debian and Fedora) using rsync synchronization tool to automatically synchronize Remote Server File installation and configuration steps: # cdrsync-3.0.5 #. config

Linux (Debian and FEdUsing rsyNcThe synchronization tool automatically synchronizes the installation and configuration steps of remote server files:

I. Installation
1. Debian/Ubuntu
# Apt-get install rSync(Directly use the built-in download and Installation Tools)
 
2. Fedora or others
# Tar xf rsync-3.0.5.tar.gz
#CdRsync-3.0.5
#./Configure -- profix =/usr/local/rsync (configure the installation directory as/usr/local/rsync)
# Make
# Make install

Rsync:

Free onHttp://linux.linuxIdC.com/

Both the user name and password areWww.linuxidc.com

The specific download directory is in/Pub/2011/08/16/Rsync/
 
Ii. Configuration
1. Server (123.196.114.200)
1) configuration file
# Cd/etc
# Vim rsyncd. conf
Uid = backup (I have created a backup user separately and can also use root. The default value is nobody)
Gid = backup
Use chroot = no (the default value is yes (requires root to run rsync) for additional security protection)
Max connections = 4 (set the number of connections to 4, which is unlimited by default)
PidFile=/Var/run/rsyncd. pid (tell the process to write to the/var/run/rsyncd. pid file)
Lock file =/var/run/rsyncd. lock
Log file =/var/log/rsyncd. log (log document)
 
[100 qslogbak] (module: rsync client)
Path =/home/rsync/userlog/logbackup (file directory to be backed up)
Comment = From webserver
Auth user = backup (the connection account does not matter to the system account. This account must exist on the server)
Secrets file =/etc/rsyncd. secrets (password storage file)
Ignore errors (to prevent serious problems due to temporary lack of resources or other IO errors)
Read only = no (read-only option, that is, do not allow the client to upload files to the server)
List = no (do not display the directories that list the synchronized data on the rsync server)
 
[114bak] (module: Another rsync client)
Path =/home/rsync/userlog
Comment = From agentserver
Auth user = backup
Secrets file =/etc/rsyncd.Pwd
Ignore errors
Read only = yes
List = no
#: Wq (save and Exit)
# Vim rsyncd. secretes
Username: Password (for example, backup: 123456789)
#: Wq (save and Exit)
#Chmod600 rsyncd. secretes (the Community Password File Permission is 600, which must be set in this step)
2) start the service
#/Usr/bin/rsync -- daemon (-- config =/etc/rsyncd. conf)
2. Client (192.168.1.100)
The client only needs to configure the password file.
# Cd/etc
# Vim rsyncd. secretes
Password (e.g. 123456789)
# Chmod 600 rsyncd. secretes (the Community Password File Permission is 600, which must be set in this step)
Note: The password must be consistent with the password in the rsync server password file. The password of the rsync client should also be used.
#/Usr/bin/rsync -- zvrtopg -- password-file =/etc/rsyncd. secretes -- progress
Rsync@112.106.114.200: 100 qslogbak/home/rsync/userlog/
Note:CommandThis means to synchronize files in the path/home/rsync/userlog/logbackup on the server to the path/home/rsync/userlog/on the client. If you want to synchronize the client files to the server, it is as follows:
#/Usr/bin/rsync -- zvrtopg -- password-file =/etc/rsyncd. secretes -- progress
/Home/rsync/userlog/rsync@112.106.114.200: 100 qslogbak
# Vim backup. sh (Save the command to a script file for scheduled tasks)
/Usr/bin/rsync -- zvrtopg -- password-file =/etc/rsyncd. secretes -- progress
Rsync@112.106.114.200: 100 qslogbak/home/rsync/userlog/
#: Wq
3. Set firewall
Rsync uses the default port 873. After installation and configuration, both the client and the server need to set a firewall.
# Iptables-I INPUT-p tCp-- Dport 873-j ACCEPT
# Iptable-L (view firewall settings)
 
Iii. scheduled tasks
In order for the system to automatically execute file synchronizationCrontab.
# Crontab? U root? E
00 2 *** sh/usr/bin/backup. sh (scheduled task executed at two o'clock AM)
# Echo "/usr/bin/rsync -- daemon">/etc/rc. local (the rsync service is automatically started upon startup)
 
Iv. Notes
1) The system prompts that the password file cannot be read. If you need to manually enter the password, it may be that the password file permission is not 600, the format is incorrect, or the path is incorrect.
2) If you are prompted to create a new directory or file transfer fails, it may be because the directory you want to synchronize has no permission. You 'd better change the permission of the directory you want to synchronize to 744.
3) When Synchronizing files from the client to the server, it is best to transfer a single file directory; otherwise, errors may occur.

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.