rsync的详细配置

服务器配置:

yum install rsync   安装rsync

vi /etc/rsyncd.conf   创建主配置文件

pid file = /var/run/rsyncd.pid

port = 873

address = 服务器IP

uid = root

gid = root

use chroot = yes

read only = no

write only = no

hosts allow = 备份服务器的IP

hosts deny = *

max connections = 10

timeout = 300

motd file = /etc/rsyncd.motd

log file = /var/log/rsyncd.log

transfer logging = yes

log format = %t %a %m %f %b

[backup]

path=要被备份的文件路径

list = yes

ignore errors = yes

auth users = fsl

secrets file=/etc/rsyncd.secrets

vi /etc/rsyncd.secrets 创建密码文件

fsl:123456

chmod 600 /etc/rsyncd.secrets 将rsyncd.secrets这个密码文件的文件属性设为root拥有, 

且权限要设为600, 否则无法备份成功!

chkconfig rsync on

/usr/bin/rsync --daemon  启动服务

rsync --list-only 用户@IP::配置文件中[]中的内容    

验证是否成功,这个在主服务器备份服务器都可以验证

::后面的,是指的主配置文件下面在[]写到的

备份服务器需要做的配置,

安装服务   yum -y install rsync

无需输入密码访问

echo "123456">>/etc/rsyncd.secrets

rsync --list-only --password-file=/etc/rsyncd.secrets 用户@IP::配置文件中[]中的内容

原文地址:https://www.cnblogs.com/sexiaoshuai/p/7285077.html