Linux中使用rsync实现多服务器之间文件同步问题

首先我的服务器端ip:192.168.122.129

客户端IP: 192.168.122.111

1.先来配置服务器端:

确认是否安装rsync

# rpm -qa |grep rsync

如果没有安装可以从光盘上安装如下:


1.      挂载光盘:

Mkdir /mnt/cdrom

Mount /dev/hdc /mnt/cdrom

Cd Server

 rpm -ivh rsync-2.5.6-20.i386.rpm

umount  /mnt/cdrom

eject

2. 配置rsync
 在 /etc/xinetd.d/rsync

将disable=yes改为no
service rsync
{
disable = no
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}

3.配置rsync自启动

4.自己配置rsyncd.conf

uid= root
gid = root
use chroot = no
max connections = 4
strict modes = yes
port = 873

hosts allow = 192.168.122.111
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[backup]   #你要备份的
path = /srv    #实际目录
comment = This is test
auth users = scihoo
uid = root
gid = root
secrets file = /home/rsync.ps
read only = no
list = no

5./etc/services 里面添加873端口

rsync873/tcp # rsync
rsync 873/udp # rsync

8 启动

启动成功 服务器端完成

相关推荐