rsync远程同步
实验环境描述:
某公司在深圳,北京各放置了一台网站服务器,分别应对南北大区内不断增长的客户访问需求,两台服务器的网站文档必须保持一致,如图,同步链路已通过VPN专用线路实现
需求描述:
服务器A(北京)作为rsync发起端,目录/var/www/html作为原始位置
服务器B(深圳)作为远程rsync服务器,目录/var/www/html作为目标位置
结合inotify机制实现触发式的上行同步,保持两个站点的网页文档一致
推荐步骤:
配置rsync服务器(深圳,服务器B)
通过inotify机制实现实时同步(北京,服务器A)
实验步骤:
1.安装
1.配置
[root@centos ~]# vim /etc/rsyncd.conf
2.创建验证数据库
[root@centos ~]# vim /etc/rsync.db
3.创建目录文件
[root@centos01 ~]# mkdir /bdqn
[root@centos01 ~]# echo “111” > /bdqn/1.txt
[root@centos01 ~]# echo “222” > /bdqn/2.txt
root@centos01 ~]# echo “333” > /bdqn/3.txt
4.管理rsync服务
[root@centos01 ~]# rsync --daemon
[root@centos01 ~]# netstat -anptu | grep rsync
5.配置客户端实时同步
[root@centos01 inotify-tools-3.14]# ./configure
[root@centos01 inotify-tools-3.14]# make && make install
6.修改内核参数,和数据同步