备份方案

原理和工作性质不在介绍,直接看安装:(很简单)

服务端:(备份服务器端)

useradd -s /sbin/nologin -M rsync

vi rsyncd.conf
##rsyncd.conf start##
uid = rsync
gid = rsync
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /home/logs/rsync/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 192.168.10.0/24
auth users = user_backup
secrets file = /etc/rsync.password
[chandao]
path = /home/backup/

echo "rsync_backup:backupall" >/etc/rsync.password
chmod 600 /etc/rsync.password
mkdir /backup
chown -R rsync.rsync /backup
rsync --daemon

客户端:(业务主机端)

echo "backupall" >/etc/rsync.password
chmod 600 /etc/rsync.password

因为做的是实时同步,所以用到sersync:(客户端安装)

cd /home/tools/
wget http://dd.jb51.net:81/201111/tools/sersync_64bit_binary_stable_final.tar.gz
tar xf sersync_64bit_binary_stable_final.tar.gz -C /usr/local/
cd /usr/local/
mv GNU-Linux-x86/ sersync
cd sersync/
mkdir conf bin logs
mv confxml.xml conf/
mv sersync2 bin/sersync

配置文件修改

24             要同步的本地目录
25              同步的机器和模板名

    
      关闭了无差异同步
    

        
        
        
        
        
        
        

36      

提示
这些其实就是在拼接同步命令

rsync -avzP --timeout=100 /backup/* [email protected]::backup --password-file=/etc/rsync.password 

加入环境变量

echo 'export PATH=$PATH:/usr/local/sersync/bin' >>/etc/profile
. /etc/profile

启动命令

sersync -r -d -o /usr/local/sersync/conf/confxml.xml  

-r让服务器数据保持一致(第一次用),-o指定配置文件,-d 后台执行

rsyncd启动脚本可以自行开发

你可能感兴趣的:(备份方案)