linux文件实时同步
2015-10-13 10:35
495 查看
服务器:A:ip--192.168.1.110,linux版本--Redhat6.4
B:ip--192.168.1.111,linux版本--Redhat6.4
-------------------------------------------------
所需文件:linux-sersync2.tar.gz
rsync-3.1.2pre1.tar.gz
资源csdn免积分地址:http://download.csdn.net/detail/duan847/9176125
-------------------------------------------------
实现效果:
有A、B两台服务器,A服务器/opt/tongbu目录下
文件有增、删、改将自动同步至B服务器/opt/tongbu目录下
-------------------------------------------------
操作步骤:
1、配置B服务器:
①、将rsync-3.1.2pre1.tar.gz复制到B服务器上,安装rsync;
# tar -zxvf rsync-3.1.2pre1.tar.gz
# cd rsync-3.1.2pre1
# ./configure --prefix=/usr/local/rsync
# make
# make install
②、建立配置文件:
# mkdir -p /etc/rsyncd/
# vim /etc/rsyncd.conf
uid=root
gid=root
max connections=36000
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
[tongbu]
path = /opt/tongbu
ignore errors = yes
list = yes
read only = no
hosts allow = 192.168.1.110 #允许B服务器同步
#hosts deny = *
# rsync --daemon
③、# netstat -tunlp |grep 873 (查看是否有873端口)
④、B服务器配置完成
2、配置A服务器:
①、将linux-sersync2.tar.gz复制到A服务器上,安装sersync;
# tar -zxvf linux-sersync2.tar.gz
# cd linux-sersync2
# vi config.xml (修改localpath标签,内容如下:)
<localpath watch="/opt/tongbu">
<remote ip="192.168.1.111" name="tongbu"/>
</localpath>
# ./sersync -d
②、A服务器配置完成
③、测试:# cd /opt/tongbu
# echo test >> test.txt
查看B服务器 /opt/tongbu 目录下是否有test.txt
④、完成
B:ip--192.168.1.111,linux版本--Redhat6.4
-------------------------------------------------
所需文件:linux-sersync2.tar.gz
rsync-3.1.2pre1.tar.gz
资源csdn免积分地址:http://download.csdn.net/detail/duan847/9176125
-------------------------------------------------
实现效果:
有A、B两台服务器,A服务器/opt/tongbu目录下
文件有增、删、改将自动同步至B服务器/opt/tongbu目录下
-------------------------------------------------
操作步骤:
1、配置B服务器:
①、将rsync-3.1.2pre1.tar.gz复制到B服务器上,安装rsync;
# tar -zxvf rsync-3.1.2pre1.tar.gz
# cd rsync-3.1.2pre1
# ./configure --prefix=/usr/local/rsync
# make
# make install
②、建立配置文件:
# mkdir -p /etc/rsyncd/
# vim /etc/rsyncd.conf
uid=root
gid=root
max connections=36000
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
[tongbu]
path = /opt/tongbu
ignore errors = yes
list = yes
read only = no
hosts allow = 192.168.1.110 #允许B服务器同步
#hosts deny = *
# rsync --daemon
③、# netstat -tunlp |grep 873 (查看是否有873端口)
④、B服务器配置完成
2、配置A服务器:
①、将linux-sersync2.tar.gz复制到A服务器上,安装sersync;
# tar -zxvf linux-sersync2.tar.gz
# cd linux-sersync2
# vi config.xml (修改localpath标签,内容如下:)
<localpath watch="/opt/tongbu">
<remote ip="192.168.1.111" name="tongbu"/>
</localpath>
# ./sersync -d
②、A服务器配置完成
③、测试:# cd /opt/tongbu
# echo test >> test.txt
查看B服务器 /opt/tongbu 目录下是否有test.txt
④、完成
相关文章推荐
- Linux socket 初步
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- 基于 Linux 集群环境上 GPFS 的问题诊断
- 谁是桌面王者?Win PK Linux三大镇山之宝
- vivi下重新调整分区