一、rsync服务端配置流程
1. 配置rsync配置文件/etc/rsyncd.conf
2. 创建同步的本地目录/dingjian 并根据需要授权
目录和/etc/rsync.password为配置文件中path = /dingjian/参数的配置
3. 账号密码文件配置:
echo "rsync_backup:dingjian">/etc/rsync.password
chmod 600 /etc/rsync.password
提示:
1)/etc/rsync.password为配置文件中secrets file = /etc/rsync.password参数的配置
2)账号rsync_backup为/etc/rsync.password为配置文件中auth users = rsync_backup参数的配置\
4. 启动rsync服务
[[email protected]]# rsync --daemon [[email protected] dingjian]# echo"/usr/bin/rsync --daemon">>/etc/rc.local [[email protected] dingjian]# cat/etc/rc.local |grep daemon [[email protected] dingjian]# ps-ef |grep rsync
重起
[[email protected] dingjian]#pkill rsync [[email protected] dingjian]#rsync --daemon [[email protected] dingjian]# ps-ef |grep rsync
二、rsync客户端配置流程:
[[email protected] etc]# echo "dingjian">/etc/rsync.password chmod 600 /etc/rsync.password
提示:
客户端的/etc/rsync.password和服务端的/etc/rsync.password没有任务关系,只要和客户端rsync命令接的参数—password-file=/etc/rsync.password中的路径对应即可
三、rsync客户端命令操作细节
推送整个目录
rsync-avz /tmp [email protected]::dingjian--password-file=/etc/rsync.password
只推送目录中的文件
rsync-avz /tmp/ [email protected]::dingjian--password-file=/etc/rsync.password
抓取rsync模块对应目录里的文件
rsync [email protected]::dingjian --password-file=/etc/rsync.password /tmp