Centos6安裝配置rsync+inotify實時單向同步
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
實驗環境: Server : 192.168.9.109 rsync +inotify
WEB1:192.168.9.106 rsync server
WEB2:192.168.9.104 rsync server
Server為分發機,有內容更新則推送 rsync server
注:也可以WEB到Server拉取資料 (1)Server下載安裝 rsync +inotify
下載安裝 rsync
#wget https://download.samba.org/pub/rsync/rsync-3.1.2.tar.gz #tar xf rsync-3.1.2.tar.gz #cd rsync-3.1.2 #./configure #make #make install 下載安裝inotify # uname -r 2.6.32-431.el6.x86_64 # ls -l /proc/sys/fs/inotify total 0 -rw-r--r-- 1 root root 0 Aug 30 12:28 max_queued_events -rw-r--r-- 1 root root 0 Aug 30 12:28 max_user_instances -rw-r--r-- 1 root root 0 Aug 30 12:28 max_user_watches 如果有上面三項輸出,表示系統已經預設支援inotify,接著就可以開始安裝inotify-tools了。 # cd /usr/local/src/ # wget http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz # tar xf inotify-tools-3.14.tar.gz # cd inotify-tools-3.14 # ./configure # make # make install # ll /usr/local/bin/inotifywa* -rwxr-xr-x 1 root root 44287 Aug 31 12:23 /usr/local/bin/inotifywait
-rwxr-xr-x 1 root root 41377 Aug 31 12:23 /usr/local/bin/inotifywatch
#inotify-tools安裝完成後,會生成inotifywait和inotifywatch兩個指令,其中,inotifywait用於等待檔案或檔案集上的一個特定事件,它可以監控任何檔案和目錄設定,並且可以遞迴地監控整個目錄樹。 inotifywatch用於收集被監控的檔案系統統計資料,包括每個inotify事件發生多少次等資訊。 配置SERVER節點: # vim /data0/inotify.sh #!/bin/bash host1=192.168.9.104 host2=192.168.9.106 src= /webroot/
dst1=WEB1 dst2=WEB2 /usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' -- format '%T %w%f%e' \
-e modify,delete,create,attrib ${src} | which read file
do /usr/bin/rsync -vzrtopg --delete --progress ${src} ${host1}::${dst1}
/usr/bin/rsync -vzrtopg --delete --progress ${src} ${host2}::${dst2}
echo "${files} was rsyncd" > /tmp/rsync .log 2>&1
done # chmod +x /data0/inotify.sh # nohup /data0/inotify.sh & # echo "nohup /data0/inotify.sh &" >> /etc/rc.d/rc.local (2)WEB1安裝rysnc 下載安裝 rsync
#wget https://download.samba.org/pub/rsync/rsync-3.1.2.tar.gz #tar xf rsync-3.1.2.tar.gz #cd rsync-3.1.2 #./configure #make #make install 配置 rsync
# cat /etc/rsyncd.conf uid = nobody gid = nobody use chroot = no max connections = 10 pid file = /var/run/rsyncd .pid
log file = /var/log/rsync .log
lock file = /var/lock/rsync .lock
hosts deny = * [WEB1] path = /var/www/htm1
comment = WEB1 ignore errors read only = no
write only = no hosts allow = 192.168.9.109 192.168.1.104 192.168.5.0 /24
list = false
uid = root gid = root 啟動 #/usr/local/bin/rsync --daemon --config=/etc/rsyncd.conf #echo "/usr/local/bin/rsync --daemon --config=/etc/rsyncd.conf" >> /etc/rc.d/rc.local (3)WEB2下載安裝 rsync
#wget https://download.samba.org/pub/rsync/rsync-3.1.2.tar.gz #tar xf rsync-3.1.2.tar.gz #cd rsync-3.1.2 #./configure #make #make install 配置 rsync
uid = nobody gid = nobody use chroot = no max connections = 10 pid file = /var/run/rsyncd .pid
log file = /var/log/rsync .log
lock file = /var/lock/rsync .lock
hosts deny = * [WEB2] path = /var/www/htm2
comment = WEB2 ignore errors read only = no
write only = no hosts allow = 192.168.9.109 192.168.1.104 192.168.5.0 /24
list = false
uid = root gid = root 啟動 #/usr/local/bin/rsync --daemon --config=/etc/rsyncd.conf #echo "/usr/local/bin/rsync --daemon --config=/etc/rsyncd.conf" >> /etc/rc.d/rc.local |
本文轉自 wpf926 51CTO部落格,原文連結:http://blog.51cto.com/wupengfei/1958258,如需轉載請自行聯絡原作者
相關文章
- rsync+inotify實時同步
- rsync+inotify資料的實時同步
- rsync+inotify實時同步環境部署記錄
- 【GoldenGate】Oracle GoldenGate(一) 安裝與DML單向同步配置GoOracle
- OGG安裝及單向配置
- canal+mysql+kafka實時資料同步安裝、配置MySqlKafka
- rsync+inotify實現實時同步(小業務場景解決方案)
- CentOS6下mysql的安裝與配置CentOSMySql
- 小白都會的rsync遠端同步原理及-------(定期同步與rsync+inotify實時同步)實驗
- 安裝配置Oracle GoldenGate for DB2(單向)OracleGoDB2
- centos6 安裝EPELCentOS
- CentOS6 安裝 RedisCentOSRedis
- 實戰goldengate:安裝配置+資料初始化+單向DML複製Go
- (一)OGG的安裝與配置,並實現單向DML複製操作
- centos6上安裝dockerCentOSDocker
- 在CentOS6上使用saltstack原始碼安裝配置mysql薦CentOS原始碼MySql
- CentOS6安裝ZendOptimizer(ZendGuardLoader)CentOS
- centos6 下的apache安裝CentOSApache
- RabbitMQ學習之(二)_Centos6下安裝RabbitMQ及管理配置MQCentOS
- webpack(簡單安裝配置)Web
- Linux系統安裝(CentOS6)LinuxCentOS
- 手把手教你安裝和配置OGG,並實現單向DML複製技術
- GoldenGate雙向同步配置Go
- 【OGG】RAC環境下配置OGG單向同步 (四)
- 簡單安裝配置lighttpdhttpd
- postfix安裝和簡單配置
- MySQL - 安裝時的安全配置MySql
- Centos6 下安裝Nginx+Mysql+PHPCentOSNginxMySqlPHP
- httpd-2.4 編譯安裝(centos6)httpd編譯CentOS
- Centos6下使用yum安裝MariaDBCentOS
- CentOS6 編譯安裝 redis-3.2.3CentOS編譯Redis
- CentOS6/7 使用saltstack源安裝saltstackCentOS
- CentOS6安裝dovecot並提供sasl功能CentOS
- heartbeat安裝配置實驗
- CentOS6 基於 Python 安裝 SentryCentOSPython
- 在 CentOS6 上安裝 Zabbix2.4 ServerCentOSServer
- centos6下安裝部署hadoop2.2CentOSHadoop
- GoldenGate單向表DML同步Go