CentOS 6.3_ RSync实现文件备份同步配置与使用
1、配置rsyncd.conf文件 rsyncd.conf 是rsync服务器主要配置文件,我们来个简单的示例: 备份服务器上的/data/share目录下所有文件,手动添加内容如下: [root@server ~]# vim /etc/rsyncd/rsyncd.conf # Distributed under the terms of the GNU General Public License v2 # Minimal configuration file for rsync daemon # See rsync(1) and rsyncd.conf(5) man pages for help # This line is required by the /etc/init.d/rsyncd script pid file = /var/run/rsyncd.pid 注:告诉进程写到 /var/run/rsyncd.pid 文件中 port = 873 注:指定运行端口,默认是873,您可以自己指定 address = 10.1.4.44 注:指定服务器IP地址 #uid = nobody 注:服务器端传输文件时,要发哪个用户和用户组来执行,默认是nobody #gid = nobody 注:服务器端传输文件时,要发哪个用户和用户组来执行,默认是nobody uid = root gid = root use chroot = yes read only = yes #limit access to private LANs hosts allow=10.1.4.0/255.255.255.0 hosts deny=* max connections = 5 注:客户端最多连接数 motd file = /etc/rsyncd/rsyncd.motd #This will give you a separate log file log file = /var/log/rsync.log #This will log every file transferred - up to 85,000+ per user, per sync #transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 timeout = 300 [samba_data] 注:模块 path = /data/share 注:指定文件目录所在路径 list=no 注:list 意思是把rsync 服务器上提供同步数据的目录在服务器上模块是否显示列出来。默认是yes 。如果你不想列出来,就no ;如果是no是比较安全的,至少别人不知道你的服务器上提供了哪些目录。你自己知道就行了 ignore errors 注:忽略IO错误,详细的请查文档 auth users = root 注:认证用户是root ,是必须在服务器上存在的用户 secrets file = /etc/rsyncd/rsyncd.secrets 注:密码存在rsyncd.secrets文件里 注: 关于 auth users 是必须在服务器上存在的真实的系统用户,如果你想用多个用户,那就以,号隔开;比如 auth users = root , user1 2、配置rsyncd.secrets文件 密码文件: rsyncd.secrets的内容格式 [root@server ~]# vim /etc/rsyncd/rsyncd.secrets root:111111 user:111111 用户名:密码 注:root:111111 而我们在例子中rsyncd.secrets的内容如下类似的;在文档中说,有些系统不支持长密码,自己尝试着设置一下吧。另外 rsyncd.secrets文件权限对其它用户组是不可读的。如果你设置错了,可能rsync不工作。 (编辑:源码门户网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |