数据备份之rsync

  

软件版本:rsync-3.0.9

需要安装xinetd服务

yum  install  xinetd  -y  # rhel apt-get  install  xinetd  -y  # ubuntu

安装

wget  http://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gzwget , http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gztar  zxvf  rsync-3.0.9.tar.gztar  zxvf  rsync-patches-3.0.9.tar.gzcd  rsync-3.0.9/configuremake ,,, make 安装

1。创建配置文件

vim /etc/rsyncd。参看 ;,港口uid=rootgid==873根   max 连接=10 log 文件=/var/log/rsyncd.log   pid 文件=/var/运行/rsyncd.pid   lock 文件=/var/运行/rsyncd.lock=/etc/rsyncd.passwd secrets 文件   ;,hosts 允许=192.168.11.0/27;,hosts 否认=192.168.11.0/255.255.255.224timeout=600, [backdir]评论=,for  client  backpath=/home/backdir/read  only =,   ;排除=测试;exclude 从=/道路//文件;include 从=/道路//fileauth 用户=caide.me[分享]评论=,backup  share  filepath=/home/分享/read  only =, yesauth 用户=caide.me

2。创建密码文件(/etc/rsyncd.passwd)

echo “caide.me: caide.me.passwd”,祝辞,/etc/rsyncd.passwdchmod  600年,/etc/rsyncd.passwd

3。创建xinetd监听任务(/etc/xinetd.d/xinetd_rsync)

vim /etc/xinetd。d/xinetd_rsync #,默认值:,从#,描述:,,rsync  server  is  a  good  addition 用an  ftp 服务器,as  it  \ #,,,,,,, allows  crc  checksumming  etc.service  rsync {   ,,,,,,disable =,没有   ,,,,,,,socket_type ,,,,=, stream ,,,,,,, wait ,,,,,,,,,,,=,   ,,,,,,,user ,,,,,,,,,,,=,根   ,,,,,,,server ,,,,,,,,,=,/usr/地方/bin/rsync   ,,,,,,,server_args ,,,=,——守护进程   ,,,,,,,log_on_failure , +=, USERID} service  xinetd 启动


安装

wget  http://rsync.samba.org/ftp/rsync/rsync-3.0.9.tar.gzwget , http://rsync.samba.org/ftp/rsync/rsync-patches-3.0.9.tar.gztar  zxvf  rsync-3.0.9.tar.gztar  zxvf  rsync-patches-3.0.9.tar.gzcd  rsync-3.0.9   。/configuremake ,,, make 安装

备份——还原文件外壳脚本

# !/bin/sh #,按照IP进行备份NIC=癮rp  -a  |, awk “{print  7美元}“NIC=癳cho  NICS 美元;| awk “{print  1美元}“SERVERIP=' | ifconfig  NIC 美元;awk “/inet /, {print  $ 2}”, | cut  -f2  -d ”:“‘#, directory 用backupBDIR=/道路//backdir #, excludes  file 作用;却;能够contains  a  wildcard  pattern  per  line  of  files 用excludeEXCLUDES=no_rsync.txt #,从而name  of 从而backup  machineBSERVER=back_server_ipif  [,“SERVERIP美元”=,“BSERVER美元”,]thenexitfi #, your  password 提醒,backup  serverUSERNAME=caide.meexport  RSYNC_PASSWORD=caide.me.passwd # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #模块=backdirOPTS=薄猣orce ——ignore-errors ——delete-excluded ——排除=$排除delete  -avz”export 路径=$路径:/bin:/usr/bin:/usr/地方/bin #,你从而actual  transferrsync  OPTS 美元;BDIR 美元;USERNAME@ BSERVER美元:模块/SERVERIP 美元,#备份#,rsync  OPTS 美元;USERNAME@ BSERVER美元:模块/SERVERIP 美元;BDIR 美元;#还原


数据备份之rsync