如何将不同linux服务器的目录内容进行双向同步


如何将不同linux服务器的目录内容进行双向同步

文章插图
 
主旨
本文的目的是为了解决两台服务器之间目录差异问题,即可以在A、B两台服务器指定目录写、删任何内容,都会同步到另一台服务器,即实现文件存放、读取高可用 。
环境
服务器信息:
node-1:192.168.93.139node-2:192.168.93.140用户名密码:
root/666666同步目录:
/home/jierVIP地址:
192.168.93.200此文档涉及到的软件:
rsynclsyncdkeepalivedsftp前期准备
关闭防火墙和selinux,两台服务器上都需要执行 。
[root@localhost jier]# systemctl stop firewalld.service[root@localhost jier]# systemctl disable firewalld.serviceRemoved symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.[root@localhost jier]# setenforce 0# 修改内容SELINUX=disabled[root@localhost jier]# vim /etc/selinux/config[root@localhost jier]# iptables -F一、部署rsync
PS:需要在node-1和node-2两个节点上同时进行安装 。


    推荐阅读