Rsync Installation Manual
---dxwang
What is rsync
Rsync,remote Synchronize as implies meaning that it is a remote synchronization software, it synchronizes files at the same time, you can keep the original file permissions, time, soft and hard links and other additional information. Rsync uses the rsync algorithm to provide a quick way for file synchronization between a client and a remote file server, and it can be transferred via SSH, so it's very confidential and it's free software.
Rsync includes some of the following features:
Can update entire directory and tree and file system;
Selective retention of symbolic chains, hard links, file belonging, permissions, equipment, and time;
For the installation, there is no special permission requirements;
For multiple files, the internal pipeline reduces the delay of file waiting;
can use rsh, SSH or direct port as the transmission port;
Support for anonymous rsync synchronization files, is the ideal image tool
Check rsync
Installing the service side
1, in the root user operation
2. Add two files/etc/rsync.pas and/etc/rsyncd.conf
Rsyncd.conf
UID = root GID = root Use chroot = no Max connections = 4 Strict modes = yes Port = 873 [Ext-lib] Path =/data/storm/ext-lib/ Comment = try to realize file synchronization Ignore errors Read Only = no List = no Auth users = Storm Secrets file =/etc/rsync.pas Hosts allow = 10.27.95.101// client IP address, multiple IPs separated by commas Hosts Deny = 0.0.0.0/0 |
Rsync.pas
3, Installation Inotify-tools
TAR-ZXVF inotify-tools-3.14.tar.gz CD inotify-tools-3.14 ./configure--prefix=/usr/local/inotify Make Make install |
4. Start rsync-monitor.sh (in/data/storm/rsync)
#!/bin/bash Ps-ef|grep "/usr/bin/rsync--daemon" |grep-v grep >/data/storm/rsync/rsync-info.log num= ' grep '/usr/bin/rsync--daemon "/data/storm/rsync/rsync-info.log|wc-l ' Echo $num If [$num-eq 0];then echo "[$ (date + '%F%T ')] rsync is down,need restart" echo "-----" >>/data/storm/rsync/rsync-info-forever.log Cat/data/storm/rsync/rsync-info.log >>/data/storm/rsync/rsync-info-forever.log /usr/bin/rsync--daemon Else echo "[$ (date + '%F%T ')] rsync is running" Fi |
5. Start rsync-inotify-monitor.sh (in/data/storm/rsync)
#!/bin/bash host=10.27.95.101,10.27.95.102// client IP src=/data/storm/ext-lib/ Des=ext-lib User=storm /usr/local/inotify/bin/inotifywait-mrq--timefmt '%d/%m/%y%h:%m '--format '%T%w%f%e '-e modify,delete,create,attrib $ src | While read files Do Ifs=, For each in $host Do /USR/BIN/RSYNC-VZRTOPG--delete--progress--password-file=/etc/rsync.pas $src [email protected] $each:: $des Done echo "${files} was rsynced" >>/data/storm/rsync/rsync-inotify.log 2>&1 Done |
Installing the Client
1. Upload three files in directory/data/storm/rsync directory rsyncd.conf, Rsync.pas and rsync-monitor.sh
Rsyncd.conf
Uid=root Gid=root Use Chroot=no Max Connections=4 Strict Modes=yes [Ext-lib] Path =/data/storm/ext-lib/ Comment = try to realize file synchronization Ignore errors Read Only = no List = no Auth users = Storm Secrets file =/data/storm/rsync/rsync.pas Hosts allow = 10.27.95.100// server IP Hosts Deny = 0.0.0.0/0 |
Rsync.pas,Rsync.pas 's permission is
rsync-monitor.sh
#!/bin/bash Num= ' Ps-ef|grep "/usr/bin/rsync--daemon" |wc-l " If [$num-eq 1];then echo "[$ (date + '%F%T ')] rsync is down,need restart" /usr/bin/rsync--daemon--config=/data/storm/rsync/rsyncd.conf Else echo "[$ (date + '%F%T ')] rsync is running" Fi |
2. Start rsync-monitor.sh
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Rsync Installation Manual