Directory
Chapter 1 rsync service configuration process ... 2
1.1 system Optimization ... 2
1.2 viewing operating system information and rsync services ... 2
1.3 Edit rsync service /etc/rsyncd.conf configuration file ... 2
Chapter 2 rsync service setup details ... 3
2.1 Create rsync user, Queen rsynd process login ... 3
2.2 Create a backup directory and modify permissions ... 3
2.3 Edit The rsync service password file and modify the file permissions ... 3
Chapter 3 Check the service configuration results ... 3
3.1 Open and check rsync service ... 3
3.2 write-on self-boot ... 4
3.3 Client rsync configuration ... 4
Chapter 4 rsync combat test ... 4
4.1 standard rsync command uses ... 4
4.2 to start the service to write to boot ... 5
1th Chapter RsyncService configuration Process1.1System Optimization1.2View operating System information andRsyncService
[Email protected]/]# cat/etc/redhat-release
CentOS Release 6.7 (Final)
[Email protected]/]# uname-r
2.6.32-573.el6.x86_64
[Email protected]/]# uname-m
x86_64
[Email protected]/]# Rpm-qa rsync
Rsync-3.0.6-12.el6.x86_64
1.3EditRsyncService/etc/rsyncd.confconfiguration file
[[email protected]/]# vim/etc/rsyncd.conf (the comment below cannot be written after the line, causing the configuration file to fail, error)
#rsync_config______start
#created by Crazy Frog
# #rsyncd. Cong start##
Uid=rsync # #virtual Users UID
Gid=rsync # #virtual users gid
Use chroot=no # #safe system config
Max connections=200 # #max link Users
TIMEOUT=300 # #delay Time
PID File=/var/run/rsyncd.pid # #process file for rsync
Lock File=/var/run/rsyncd.lock # #lock file for file the same
Log File=/var/log/rsyncd.log # #rsync log file
Hosts ALLOW=172.16.1.0/24
[Backup] # #modules must##
Path=/backup # #directory
Ignore errors # #no Check errors
Read Only=false
List=false
Auth Users=rsync_backup
Secrets File=/etc/rsync.password # #virtual Userspassword
# #rsyncd. conf end##
"/etc/rsyncd.conf" [New] 21L, 854Cwritten
2nd Chapter RsyncService Building Details2.1CreateRsyncUser, QueenRsyndlogon of the process
[[email protected]/]# useradd-s/sbin/nologin-m rsync remote command use that user to access the backup directory
[Ro[email protected]/]# tail-1/etc/passwd
Rsync:x:500:500::/home/rsync:/sbin/nologin
2.2Create a backup directory and modify permissions
[Email protected]/]# Mkdir/backup
[Email protected]/]# Ls-ld/backup
Drwxr-xr-x 2 root root 4096 Sep 8 08:20/backup
[Email protected]/]# chown-r rsync.rsync/backup
[Email protected]/]# Ls-ld/backup
Drwxr-xr-x 2 rsync rsync 4096 Sep 8 08:20/backup
2.3EditRsyncService's password file and modify file permissions
[Email protected]/]# Vim/etc/rsync.password
Rsync_backup=oldboy
"/etc/rsync.password" [New] 1L, 20Cwritten
[Email protected]/]# Ls-ld/etc/rsync.password
-rw-r--r--1 root root (SEP) 8 08:29/etc/rsync.password
[Email protected]/]# chmod 600/etc/rsync.password
[Email protected]/]# Ls-ld/etc/rsync.password
-RW-------1 root root (SEP) 8 08:29/etc/rsync.password
[Email protected]/]# Cat/etc/rsync.password
Rsync_backup=oldboy
3rd ChapterCheck service configuration results3.1Open and checkRsyncService
[Email protected]/]# rsync--daemon
[Email protected]/]# Ps-ef|grep rsync|grep-v grep
Root 10262 1 0 07:59? 00:00:00 rsync--daemon
[Email protected]/]# Ps-ef|grep rsync
Root 10262 1 0 07:59? 00:00:00 Rsync–daemon process is under root
root [[Email protected]/]# lsof-i: 873
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
rsync 10262 root 3u IPv4 125661 0t0 TCP *:rsync (LISTEN)
rsync 10262 root 5u IPv6 125662 0t0 TCP *:rsync (LISTEN)
[Email protected]/]# Netstat-lntup|grep 873
TCP 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 10262/rsync
TCP 0 0::: 873:::* LISTEN 10262/rsync 10302 9542 008:01 pts /0 00:00:00 grep rsync
3.2write -on self-boot
[Email protected]/]# echo "/usr/bin/nc--daemon" >>/etc/rc.local
[Email protected]/]# tail-1/etc/rc.local
Rsync--daemon
3.3ClientRsyncConfiguration
[Email protected]/]# Mkdir/backup
[Email protected]/]# Vim/etc/rsync.password
Oldboy
"/etc/rsync.password" [New] 2L, 8Cwritten
[Email protected]/]# Cat/etc/rsync.password
Oldboy
[Email protected]/]# Chmod/etc//rsync.password
chmod:missing operand after '/etc//rsync.password '
Try ' chmod--help ' for more information.
[Email protected]/]# chmod 600/etc/rsync.password
[Email protected]/]# Ls-ld/etc/rsync.password
-RW-------. 1 root root 8 Sep 8 08:58/etc/rsync.password
4th Chapter RsyncReal- Combat testing4.1StandardRsynccommand to use
[Email protected]/]# rsync-avz/backup/[email Protected]::backup--password-file=/etc/rsync.password
Sending incremental file list
./
Oldboy.txt
Sent bytes received bytes 73.33 Bytes/sec
Total size was 0 Speedup is 0.00
[Email protected] backup]# Ls-ld/backup
Drwxr-xr-x 4 rsync rsync 4096 Sep 9 00:50/backup
[Email protected] backup]# Ls-ld/backup/oldboy
Drwxr-xr-x 2 root root 4096 Sep 9 00:50/backup/oldboy
[Email protected] backup]# chown-r Rsync.rsync/backup/oldboy
[Email protected] backup]# Ls-ld/backup/oldboy
Drwxr-xr-x 2 rsync rsync 4096 Sep 9 00:50/backup/oldboy
[Email protected] backup]# Rsync-avz/backup/[email protected]::backup/oldboy--password-file=/etc/rsync.password c0> push (This method is relatively concise)
Sending incremental file list
./
A
G
Test1
{c.. G
. ice-unix/
Sent 131000 bytes received 186 bytes 37481.71bytes/sec
Total size was 134217728 speedup is 1023.11
[Email protected] backup]# RSYNC-AVZ [email protected]:: backup/oldboy/backup/--PASSWORD-FILE=/ETC/RSYNC.P Assword Client Pull
4.2Start the service startup write to boot
[Email protected] oldboy]# echo "/usr/bin/rsync--daemon" >>/etc/rc.local
[Email protected] oldboy]# tail/etc/rc.local
#!/bin/sh
#
# This script is executed *after* all theother init scripts.
# can put your own initialization stuff inhere if you don ' t
# want to does the full Sys V style init stuff.
Touch/var/lock/subsys/local
>/etc/udev/rules.d/70-persistent-net.rules
/usr/bin/rsync–daemon
To view logs:
[Email protected] oldboy]# Tail/var/log/rsyncd.log
2016/09/09 00:49:34 [2143] Receiving file list
2016/09/09 00:49:34 [2143]./
2016/09/09 00:49:34 [2143] sent 213 bytes received 457 bytes Total size 134217728
2016/09/09 00:51:58 [2169] Params.c:parameter ()-ignoring badly formed line in configuration File:ignore errors
This article is from the "11566241" blog, please be sure to keep this source http://crazyfrog.blog.51cto.com/11566241/1851019
Rsync Backup Service configuration process