centos 7 編譯安裝以及配置rsync+inotify 文件實時同步操作記錄
阿新 • • 發佈:2018-04-24
註意 .com 操作記錄 修改 pid 指定 服務 entos 實時同步
準備工作:
服務器A 源文件服務器
服務器B 數據備份服務器
註意:服務器A修改文件 實時同步到 服務器B, 服務器A和B都需要安裝rsync,並且服務器A還需要安裝inotify
一、 安裝rsync 、inotify
看一下你服務器有沒有安裝這兩款軟件 rpm -aq|grep rsync rpm -aq|grep inotify
我們采用編譯安裝的方式,夠學習到更多
下載 rsync-3.0.9.tar.gz 和inotify-tooles-3.14.tar.gz的壓縮包,我下載放到了我服務器上的/usr/local/src 目錄下,這個隨意
二、配置rsync
新建rsync配置文件
touch /etc/rsyncd.conf
內容如下:
# /etc/rsyncd: configuration file for rsync daemon mode # See rsyncd.conf man page for more options. # configuration example: uid = nobody gid = nobody use chroot = no max connections = 4 log file = /var/log/rsyncd.log lock file = /var/run/rsyncd.lock pid file = /var/run/rsyncd.pid motd file = /etc/rsyncd.motd #exclude = lost+found/ transfer logging = yes port = 873 read only = yes #是否允許客戶端上傳數據,yes 表示不允許 #timeout = 900 #ignore nonreadable = yes # dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2 [test] path = /home/wwwroot/test auth user = tom secrets file = /etc/rsyncd.secrets #用來認證客戶端的密鑰文件 #hosts allow = 192.168.0.1 #設置允許那些主機進行同步數據 #hosts deny = * #除了hosts allow定義的主機外,拒絕其他所有 #exclude = // #排除指定目錄
centos 7 編譯安裝以及配置rsync+inotify 文件實時同步操作記錄