rsync 简单应用
由于工作需要,要架设备份总结如下
1.第一:安装rsync
通过命令:yum -y install rsync 服务器,客服端均要安装
2.第二:配置rsync
主要三个配置文件需要来填充
a. touch /etc/rsyncd.conf (目录可以自己定义,启动时候弄清配置文件即可,建议默认)
vi /etc/rsyncd.conf
1 # Distributed under the terms of the GNU General Public License v2 2 # Minimal configuration file for rsync daemon 3 # See rsync(1) and rsyncd.conf(5) man pages for help 4 5 # This line is required by the /etc/init.d/rsyncd script 6 pid file = /var/run/rsyncd.pid 7 port = 873 8 address = 192.168.1.2 9 10 #uid = nobody 11 #gid = nobody 12 13 uid = root 14 gid = root 15 16 use chroot = no 17 read only = yes 18 19 #limit access to private LANs 20 hosts allow=192.168.1.101 21 #hosts deny=* 22 23 max connections = 5 24 motd file = /etc/rsyncd.motd 25 26 #This will give you a separate log file 27 #log file = /var/log/rsync.log 28 log file = /var/log/rsyncd.log 29 30 #This will log every file transferred - up to 85,000+ per user, per sync 31 #transfer logging = yes 32 33 log format = %t %a %m %f %b 34 syslog facility = local3 35 timeout = 300 36 37 [datatest] 38 path = /data/test_rsync 39 list=yes 40 ignore errors 41 auth users = test 42 secrets file = /etc/rsyncd.pa 43 comment = This is dianzpweb 44 45 [named] 46 path = /data/named 47 list=yes 48 ignore errors 49 auth users = test 50 secrets file = /etc/rsyncd.pa 51 comment = This is named
注意IP,还有运用用户ID,用户组ID,
b. touch /etc/rsyncd.pa 创建密码文件 格式:用户名:用户密码
vi /etc/rsyncd.pa 注意此文件权限必须为 600
chmod 600 /etc/rsyncd.pa
1 test:test
c. touch /etc/rsyncd.motd
vi /etc/rsyncd.motd
这个文件可以随便写了
1 ++++++++++++++++++++++++++++++++++++++++++++++ 2 Welcome to use the thinkhu rsync services! 3 2002------2013 4 ++++++++++++++++++++++++++++++++++++++++++++++
到这里就已经完成服务器端的配置了,简单吧
第三:客户端的操作
rsync -avzP test@192.168.1.2::named namedbck
就可以实现目录备份,具体参数自己可以网上查

浙公网安备 33010602011771号