目录
五、客户端测试-使用Rsync服务将远端的backup目录拉取到当前目录
一 、什么是rync ?
-
rsync —— remote synchronize ,是一款实现远程同步功能的软件;
-
rsync使用“Rsync算法”来同步文件,该算法只传送两个文件的不同部分,因此速度相当快;
-
同步文件的同时,可以保持原来文件的权限、时间和目录结构;
-
对于多个文件来说,内部流水线减少文件等待的延时;
-
rsync默认监听TCP 873端口,通过远程shell如rsh和ssh复制文件。同时要求必须在远程和和本地系统上都安装sync。
二、准备工作(linux-linux文件实时同步)
-
源文件地址(服务端):192.168.201.225 redhat
-
目标文件地址(客户端):192.168.201.226 redhat
-
请关闭防火墙:systemctl stop firewalld.service
-
查看防火墙状态:firewall-cmd --state
-
请将/etc/sysconfig/selinux/config文件中SELINUX的值为disable,修改后重启linux使修改生效,否则将影响文件同步
-
以下步骤达到的效果:服务端192.168.201.225 中进行同步的文件夹下的内容(/usr/backups/)同步复制到客户端192.168.201.226 中(/testrsync)。
-
操作系统信息如下:
-
[root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Tue Aug 18 14:50:17 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
三、安装配置 Rsync服务端(linux)
-
检查有没有安装Rsync,默认已安装(该命令会详细展示参数信息,详见附录1:rsync参数
[root@localhost ~]# rsync rsync version 3.1.2 protocol version 31 Copyright (C) 1996-2015 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/ Capabilities: 64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints, socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace, append, ACLs, xattrs, iconv, symtimes, prealloc rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the GNU General Public Licence