rsync异机备份

时间:2022-09-19 07:21:53

参考http://www.cnblogs.com/itech/archive/2009/08/10/1542945.html

1、服务器

新建/etc/rsyncd.conf  ->新建/etc/rsyncd.secrets ->运行rsync --daemon或修改/etc/xinetd.d/rsync(修改后,须执行service xinetd restart)

vi /etc/rsyncd.conf

  

# Distributed under the terms of the GNU General Public License v2
# Minimal configuration file for rsync daemon
# See rsync() and rsyncd.conf() man pages for help # This line is required by the /etc/init.d/rsyncd script
port =
address = 192.168.0.106
uid = root
gid = root use chroot = no
read only = yes #limit access to private LANs
hosts allow=192.168.0.109
hosts deny=*
max connections = #This will give you a separate log file
log file = /var/log/rsync.log [test]
#指定文件目录所在位置,这是必须指定的
path = /root/test
list=yes
ignore errors
#认证用户必须在服务器上存在的用户
auth users = root
#含有上行的用户
secrets file = /etc/rsyncd.secrets
comment = This is test data
#exclude = exclude file or dir
vi /etc/rsyncd.secrets
root:pwd

2、客户端

首先:我们看看rsync服务器上提供了哪些可用的数据源

rsync  --list-only  root@192.168.145.5::

然后:同步数据

rsync -avzP root@192.168.145.5::test test