网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

数据备份之–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 install

1.创建配置文件

vim /etc/rsyncd.conf
; port=873uid=rootgid=root
max connections=10log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
secrets file=/etc/rsyncd.passwd
; hosts allow=192.168.11.0/27; hosts deny=192.168.11.0/255.255.255.224timeout=600 [backdir]comment= for client backpath=/home/backdir/read only = no
;exclude=test;exclude from=/path/to/file;include from=/path/to/fileauth users=caide.me[share]comment= backup share filepath=/home/share/read only = yesauth users=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
# default: off# description: The rsync server is a good addition to an ftp server, as it \#       allows crc checksumming etc.service rsync{
        disable = no
        socket_type     = stream        wait            = no
        user            = root
        server          = /usr/local/bin/rsync
        server_args     = --daemon
        log_on_failure  += USERID}
service xinetd restart

–>如有需要,防火墙需开启tcp协议873端口<--

客户端配置
>安装

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 install

备份-还原文件shell脚本

#!/bin/sh# 按照IP进行备份NICS=`arp -a | awk '{print $7}'`NIC=`echo $NICS |awk '{print $1}'`SERVERIP=`ifconfig $NIC | awk '/inet / {print $2}' | cut -f2 -d ":"`# directory to backupBDIR=/path/to/backdir# excludes file - this contains a wildcard pattern per line of files to excludeEXCLUDES=no_rsync.txt# the name of the backup machineBSERVER=back_server_ipif [ "$SERVERIP" = "$BSERVER" ]thenexitfi# your password on the backup serverUSERNAME=caide.meexport RSYNC_PASSWORD=caide.me.passwd########################################################################MODULE=backdirOPTS="--force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES--delete -avz"export PATH=$PATH:/bin:/usr/bin:/usr/local/bin# now the actual transferrsync $OPTS $BDIR $USERNAME@$BSERVER::$MODULE/$SERVERIP  #备份# rsync $OPTS $USERNAME@$BSERVER::$MODULE/$SERVERIP $BDIR #还原

网站标题:数据备份之–rsync
转载来源:http://bjjierui.cn/article/jjsghd.html

其他资讯