Rsync守护进程模式部署

1)服务端部署流程

第一:检查软件是否安装

[root@backup ~]# rpm -qa rsync

rsync-3.0.6-12.el6.x86_64

 

第二:编写配置文件

#rsync_config

#created by HQ at 2017

##rsyncd.conf start##

uid = rsync

gid = rsync

use chroot = no

max connections = 200

timeout = 300

pid file = /var/run/rsyncd.pid

lock file = /var/run/rsync.lock

log file = /var/log/rsyncd.log

ignore errors

read only = false

list = false

hosts allow = 172.16.1.0/24

hosts deny = 0.0.0.0/32

auth users = rsync_backup

secrets file = /etc/rsync.password

[backup]

comment = “backup dir by sung”

path = /backup

 

第三:创建备份目录管理用户

useradd rsync -M -s /sbin/nologin

 

第四:创建备份目录

mkdir /backup

chown -R rsync.rsync /backup

 

第五:创建认证文件

echo “rsync_backup:sung123” >>/etc/rsync.password

chmod 600 /etc/rsync.password

 

第六:启动rsync服务

rsync –daemon

 

第七:检查rsync是否开启

[root@backup ~]# ps -ef|grep rsync

root 1539 1 0 03:58 ? 00:00:00 rsync –daemon

root 1557 1460 0 04:03 pts/0 00:00:00 grep rsync

[root@backup ~]# netstat -lntup|grep rsync

tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 1539/rsync

tcp 0 0 :::873 :::* LISTEN 1539/rsync

 

 

2)客户端部署流程

第一:确认软件是否安装

[root@backup ~]# rpm -qa rsync

rsync-3.0.6-12.el6.x86_64

 

第二:创建认证密码文件(这里的密码文件和服务器的密码文件格式不一样,切记)

echo “sung123” >>/etc/rsync.password

chmod 600 /etc/rsync.password

第三:进行数据备份测试

[root@nfs01 tmp]# rsync -avz /etc/hosts rsync_backup@172.16.1.41::backup –password-file=/etc/rsync.password

sending incremental file list

hosts

 

sent 189 bytes received 27 bytes 432.00 bytes/sec

total size is 352 speedup is 1.63