Linux中使用rsync实现多服务器之间文件同步问题 | 您所在的位置:网站首页 › rsync使用文档 › 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改为noservice rsync{disable = nosocket_type = streamwait = nouser = rootserver = /usr/bin/rsyncserver_args = --daemonlog_on_failure += USERID} 3.配置rsync自启动 [[email protected] etc]#chkconfig rsync on[[email protected] etc]# chkconfig rsync --listrsync on 4.自己配置rsyncd.conf uid= rootgid = rootuse chroot = nomax cOnnections= 4strict modes = yesport = 873 hosts allow = 192.168.122.111pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.log[backup] #你要备份的path = /srv #实际目录comment = This is testauth users = scihoouid = rootgid = rootsecrets file = /home/rsync.psread Only= nolist = no 5./etc/services 里面添加873端口 rsync873/tcp # rsyncrsync 873/udp # rsync 6.. 配置rsync密码(在上边的配置文件中已经写好路径)/home/rsync.ps(名字随便写,只要和上边配置文件里的一致即可),格式(一行一个用户)[[email protected] etc]# vi /home/rsync.psroot:123456 7. 配置rsync密码文件权限,进入home目录[[email protected] home]# chown root.root rsync.ps[[email protected] home]# chmod 700 rsync.ps 8 启动 启动rsync服务[[email protected] home]# /usr/bin/rsync ?daemon 9. 加入rc.local在各种操作系统中,rc文件存放位置不尽相同,可以修改使系统启动时把rsync --daemon加载进去。[[email protected] home]# vi /etc/rc.local/usr/local/rsync ?daemon #加入一行 9检查rsync是否启动[[email protected] home]# lsof -i :873COMMAND PID USER FD TYPE DEVICE SIZE NODE NAMExinetd 4396 root 5u IPv4 633387 TCP *:rsync(LISTEN) 启动成功 服务器端完成 |
CopyRight 2018-2019 实验室设备网 版权所有 |