rsync服务搭建
准备两台虚拟机
192.168.1.131
192.168.1.140
安装rsync (主)
yum -y install rsync
vim /etc/rsyncd.conf
添加以下:
motd file=/etc/rsyncd.welcome
[test]
path=/world
如图:
编辑自己的欢迎语
vim /etc/rsyncd.welcome
启动服务 关闭防火墙 沙盒
systemctl start rsyncd.service
systemctl stop firewalld
setenforce 0
创建文件 等待验证
mkdir /world
touch /world/{1…9}.txt
第二台虚拟机:
yum -y install rsync
查看同步路径名
rsync -v 192.168.1.131::
上台主机 IP
如图:
创建同步目录并同步,验证是否成功
mkdir /123
rsync -a 192.168.1.131::test /123/
如图:成功
crontab -e 设置启动定时任务
每小时启动一次成功!