rsync+inotify+firewall+lamp实现自动同步等相关功能

本文涉及的产品
云解析 DNS,旗舰版 1个月
公网NAT网关,每月750个小时 15CU
全局流量管理 GTM,标准版 1个月
简介:

本次试验主要是有如下功能:

1、rsync+inotify实现自动推送;同步更新;

2、firewall可以进行地址转换以及控制访问;

3、DNS服务可以对不同的客户端解析到不同的地址;outter client解析地址为1.110;inter client解析地址为251.85。


大致规划如下:

dns server:172.16.251.84

lamp:

   httpd:172.16.251.85

   php:  172.16.251.86

   mysql:172.16.251.87

firewall: 172.16.251.88(内网)/192.168.1.110(外网)

outter clients:192.168.1.119

inter clients:172.16.254.28(宿主机)

wKiom1M27Nzw-RR_AAFAyR6eKSs459.jpg



首先需要搭建一个LAMP环境;这里就不在赘述;NFS实现LAMP分离多服务器同步更新服务Linux下编译安装LAMP并分离为多台服务器都有介绍。下面就直接从未介绍到的开始。


一、配置DNS的view模式

DNS的view模式可以使不同的网络解析到不同的IP地址。以此可以提高网络性能。

1、安装DNS服务器

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
[DNS84] #rpm -qa bind*
bind - devel - 9.8 . 2 - 0.23 .rc1.el6_5. 1.x86_64
bind - libs - 9.8 . 2 - 0.23 .rc1.el6_5. 1.x86_64
bind - 9.8 . 2 - 0.23 .rc1.el6_5. 1.x86_64         #如未安装;请事先yum安装即可
bind - utils - 9.8 . 2 - 0.23 .rc1.el6_5. 1.x86_64
[DNS84] #
[DNS84] #vim /etc/named.conf
#查看主配置文件
/ /  named.conf
/ /
/ /  Provided by Red Hat bind package to configure the ISC BIND named( 8 ) DNS
/ /  server as a caching only nameserver (as a localhost DNS resolver only).
/ /
/ /  See  / usr / share / doc / bind * / sample /  for  example named configuration files.
/ /
options {
/ /       listen - on port  53  127.0 . 0.1 ; };   #注释;即可监听所有本机地址
/ /       listen - on - v6 port  53  { :: 1 ; };     #注释IPv6
         directory        "/var/named" ;     #区域文件存放位置
         dump - file        "/var/named/data/cache_dump.db" ;
         statistics - file  "/var/named/data/named_stats.txt" ;
         memstatistics - file  "/var/named/data/named_mem_stats.txt" ;
         allow - query     {  any ; };     #允许查询
         recursion yes;                #允许递归
/ /       dnssec - enable yes;
/ /       dnssec - validation yes;
/ /       dnssec - lookaside auto;
         / *  Path to ISC DLV key  * /
/ /       bindkeys - file  "/etc/named.iscdlv.key" ;
/ /       managed - keys - directory  "/var/named/dynamic" ;
};
logging {
         channel default_debug {
                 file  "data/named.run" ;
                 severity dynamic;
         };
};
/ / zone  "."  IN {                 #根域;此处注释了;是因为需要开启view
/ /       type  hint;
/ /       file  "named.ca" ;
/ / };
include  "/etc/named.rfc1912.zones" ;     #包含在内的zone
include  "/etc/named.root.key" ;         #key文件;暂时可以不用管


2、配置view来解析不同IP

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
[DNS84] #vim /etc/named.rfc1912.zones
/ /  named.rfc1912.zones:
/ /
/ /  Provided by Red Hat caching - nameserver package
/ /
/ /  ISC BIND named zone configuration  for  zones recommended by
/ /  RFC  1912  section  4.1  : localhost TLDs  and  address zones
/ /  and  http: / / www.ietf.org / internet - drafts / draft - ietf - dnsop - default - local - zones - 02.txt
/ /  (c) 2007  R W Franks
/ /
/ /  See  / usr / share / doc / bind * / sample /  for  example named configuration files.
/ /
view inter {                             #这是内网的的
match - clients {  172.16 . 0.0 / 16 ; };        #来源地址;内网网段
zone  "localhost.localdomain"  IN {
         type  master;
         file  "named.localhost" ;
         allow - update { none; };
};
zone  "localhost"  IN {
         type  master;
         file  "named.localhost" ;
         allow - update { none; };
};
zone  "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"  IN {
         type  master;
         file  "named.loopback" ;
         allow - update { none; };
};
zone  "1.0.0.127.in-addr.arpa"  IN {
         type  master;
         file  "named.loopback" ;
         allow - update { none; };
};
zone  "0.in-addr.arpa"  IN {
         type  master;
         file  "named.empty" ;
         allow - update { none; };
};
zone  "."  IN {
         type  hint;
         file  "named.ca" ;
};
zone  "soul.org."  IN {
         type  master;
         file  "soul.org.zone.in" ;             #zone文件;路径是相对路径
};
zone  "myadmin.cn."  IN {
         type  master;
         file  "myadmin.cn.zone.in" ;
};
zone  "solitude.net."  IN {
         type  master;
         file  "solitude.net.zone.in" ;
};
zone  "pipi.com"  IN {
         type  master;
         file  "pipi.com.zone.in" ;
};
};
view out {                         #这是外网的view
match - clients {  any ; };            #除了内网IP以外的都解析到这里
zone  "soul.org."  IN {
         type  master;
         file  "soul.org.zone" ;      #文件名称
};
zone  "myadmin.cn."  IN {
         type  master;
         file  "myadmin.cn.zone" ;
};
zone  "solitude.net."  IN {
         type  master;
         file  "solitude.net.zone" ;
};
zone  "pipi.com"  IN {
         type  master;
         file  "pipi.com.zone" ;
};
};


3、提供zone文件

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
[DNS84] #ls
a.out    myadmin.cn.zone     named.empty      pipi.com.zone     solitude.net.zone     soul.org.zone. in
data     myadmin.cn.zone. in   named.localhost  pipi.com.zone. in   solitude.net.zone. in
dynamic  named.ca            named.loopback   slaves            soul.org.zone
[DNS84] #
#因为上述解析了四个;这里就其中一个为例;4个内网4个外网
[DNS84] #vi soul.org.zone
#外网文件内容
$TTL  600
@       IN     SOA  dns.soul.org.       admin.soul.org. (
                                         20140326000      ; serial
                                         1D       ; refresh
                                         1H       ; retry
                                         1W       ; expire
                                         3H  )    ; minimum
         IN      NS      dns
dns     IN      A        172.16 . 251.84     #dns地址
www     IN      A        192.168 . 1.110     #解析到外网地址
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
[DNS84] #vi soul.org.zone.in
#内网文件
$TTL  600
@       IN     SOA  dns.soul.org.       admin.soul.org. (
                                         20140326000      ; serial
                                         1D       ; refresh
                                         1H       ; retry
                                         1W       ; expire
                                         3H  )    ; minimum
         IN      NS      dns
dns     IN      A        172.16 . 251.84
www     IN      A        172.16 . 251.85     #解析到内网httpd服务器的地址


二、配置防火墙服务器

1、首先配置两个地址;并开启forward转发功能

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
[firewall88] #ifconfig
eth0      Link encap:Ethernet  HWaddr  00 : 0C : 29 : 5E : 1E : 4F
           inet addr: 172.16 . 251.88   Bcast: 172.16 . 255.255   Mask: 255.255 . 0.0
           inet6 addr: fe80:: 20c : 29ff :fe5e: 1e4f / 64  Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU: 1500   Metric: 1
           RX packets: 22798  errors: 0  dropped: 0  overruns: 0  frame: 0
           TX packets: 2698  errors: 0  dropped: 0  overruns: 0  carrier: 0
           collisions: 0  txqueuelen: 1000
           RX bytes: 2162020  ( 2.0  MiB)  TX bytes: 287328  ( 280.5  KiB)
           Interrupt: 19  Base address: 0x2000
eth1      Link encap:Ethernet  HWaddr  00 : 0C : 29 : 5E : 1E : 59
           inet addr: 192.168 . 1.110   Bcast: 192.168 . 1.255   Mask: 255.255 . 255.0
           inet6 addr: fe80:: 20c : 29ff :fe5e: 1e59 / 64  Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU: 1500   Metric: 1
           RX packets: 3516  errors: 0  dropped: 0  overruns: 0  frame: 0
           TX packets: 6654  errors: 0  dropped: 0  overruns: 0  carrier: 0
           collisions: 0  txqueuelen: 1000
           RX bytes: 334183  ( 326.3  KiB)  TX bytes: 576716  ( 563.1  KiB)
           Interrupt: 18  Base address: 0x2080
[firewall88] #sysctl -p
net.ipv4.ip_forward  =  1     #这项需要为1;
net.ipv4.conf.default.rp_filter  =  1
net.ipv4.conf.default.accept_source_route  =  0
kernel.sysrq  =  0
kernel.core_uses_pid  =  1
net.ipv4.tcp_syncookies  =  1
#可以使用sysctl net.ipv4.ip_forward=1来设置,永久生效需要更改配置文件
[firewall88] #vi /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.
# Controls IP packet forwarding
net.ipv4.ip_forward  =  1


2、把内网网段的网关指向本机内网IP

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
#DNS主机
[DNS84] #route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16 . 0.0       0.0 . 0.0          255.255 . 0.0      U      1       0         0  eth0
0.0 . 0.0          172.16 . 251.88    0.0 . 0.0          UG     0       0         0  eth0
[DNS84] #
#httpd主机
[httpd85] #route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16 . 0.0       0.0 . 0.0          255.255 . 0.0      U      1       0         0  eth0
0.0 . 0.0          172.16 . 251.88    0.0 . 0.0          UG     0       0         0  eth0
[httpd85] #
#php主机
[php86] #route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16 . 0.0       0.0 . 0.0          255.255 . 0.0      U      1       0         0  eth0
0.0 . 0.0          172.16 . 251.88    0.0 . 0.0          UG     0       0         0  eth0
[php86] #
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
#宿主机也需要添加一条;记得还需要指定DNS
IPv4 路由表
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
活动路由:
网络目标        网络掩码          网关       接口   跃点数
       192.168 . 1.0     255.255 . 255.0     172.16 . 251.88     172.16 . 254.28      21
C:\Users\Mr.chan>ping www.soul.org
#测试ping解析正常
正在 Ping www.soul.org [ 172.16 . 251.85 ] 具有  32  字节的数据:
来自  172.16 . 251.85  的回复: 字节 = 32  时间< 1ms  TTL = 64
来自  172.16 . 251.85  的回复: 字节 = 32  时间< 1ms  TTL = 64


3、配置外网IP和firewall地址转换

wKioL1M2w-PS2kw7AAGg2mm1rwE725.jpg

由于是测试;所以外网需要指定一个DNS服务器解析的;所以这里指定到了firewall这台机器的外网IP;否则无法解析的;配置firewall的地址转换规则

1
2
3
4
5
6
7
8
9
10
[firewall88] #iptables -t nat -A PREROUTING -d 192.168.1.110 -p tcp --dport 80 -j DNAT --to-destination 172.16.251.85
[firewall88] #iptables -t nat -A PREROUTING -d 192.168.1.110 -p tcp --dport 53 -j DNAT --to-destination 172.16.251.84
[firewall88] #iptables -t nat -A PREROUTING -d 192.168.1.110 -p udp --dport 53 -j DNAT --to-destination 172.16.251.84
#这里放行的是TCP:80和TCP/UDP:53端口的。
[firewall88] #iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT  4842  packets,  500K  bytes)
  pkts bytes target     prot opt  in      out     source               destination  
     5    300  DNAT       tcp   - -   *       *        0.0 . 0.0 / 0             192.168 . 1.110        tcp dpt: 80  to: 172.16 . 251.85
     0      0  DNAT       tcp   - -   *       *        0.0 . 0.0 / 0             192.168 . 1.110        tcp dpt: 53  to: 172.16 . 251.84
     8    492  DNAT       udp   - -   *       *        0.0 . 0.0 / 0             192.168 . 1.110        udp dpt: 53  to: 172.16 . 251.84

wKioL1M2xsCAnWPUAAEHob6jmXY608.jpg

wKiom1M2xvrj6d-ZAADLDqqOl3c606.jpg

测试解析访问都已正常。且地址是外网地址。


三、配置rsync服务器

1、配置httpd为rsync服务器

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
[httpd85] #yum -y install rsync
[httpd85] #yum -y install  xinetd
[httpd85] #chkconfig --list | grep rsync
     rsync:          off
[httpd85] #chkconfig rsync on
[httpd85] #
#提供配置文件给rsync
[httpd85] #vim /etc/rsyncd.con
#Global Settings
uid  =  nobody       #服务器端传输文件时,要发哪个用户和用户组来执行
gid  =  nobody
use chroot  =  no     #是否开启chroot;
max  connection  =  5     #最大连接数
strict modes  =  yes     #工作严格模式下
pid  file  =  / var / run / rsyncd.pid
log  file  =  / var / log / rsyncd.log
                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
#Directory to be synced
[httpd]         #模块名称
path  =  / usr / local / apache / www /     #存放路径
ignore errors  =  yes               #忽略IO错误信息
read only  =  no                    #只读
write only  =  no                   #只写
hosts allow  =  172.16 . 251.86        #允许的主机;白名单;这里使用的是PHP;也可以定义为其他
hosts deny  =  *                     #黑名单
list  =  false                      #是否允许以列表显示其中内容
uid  =  root                        #如全局意思一样;这里为了方便使用root;不建议
gid  =  root
auth users  =  web                  #认证的用户
secrets  file  =  / etc / rsyncd.passwd  #密码文件


2、rsync的选项

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
-n;--dry-run:测试运行;不会真正改变文件
-v;--verbose:详细输出模式
-q;--quite:静默模式
-c;--checksum:开启校验功能;强行对文件进行校验
-r;--recursive:递归复制
-a;--archive:归档;保留文件的原有属性
-p;--perms:保留文件的权限
-t;--times:保留文件的时间戳
-l;--links:保留文件的符号链接
-g;--group:保留文件的属组
-o;--owner:保留文件的属主
-D;--devices:保留设备文件
-e ssh:表示使用ssh协议作承载
-z:对文件压缩后传输
--progress:显示进度条
--stats:显示如何执行压缩和传输的-z
#更多详见man
用法
SYNOPSIS
        Local:  rsync [OPTION...] SRC... [DEST]
        Access via remote shell:
          Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
          Push: rsync [OPTION...] SRC... [USER@]HOST:DEST
        Access via rsync daemon:
          Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
                rsync [OPTION...] rsync: //[USER@]HOST[:PORT]/SRC... [DEST]
          Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
                rsync [OPTION...] SRC... rsync: //[USER@]HOST[:PORT]/DEST


3、配置密码文件和客户端地址

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
[httpd85] #vi /etc/rsyncd.passwd
#格式    用户名:密码
web:synchronous
[httpd85] #chmod 600 /etc/rsyncd.passwd
#重启下xinetd
[httpd85] #service xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
[httpd85] #ss -tunl | grep 873
tcp    LISTEN      0       64                     ::: 873                   ::: *
[httpd85] #监听与873上
                                                                                                                                                                                                                                                                                                                                                                                                                                        
#然后在客户端建一个同样的文件;同样的位置;只存放密码
[php86] #vi /etc/rsyncd.passwd
synchronous
[php86] #chmod 600 /etc/rsyncd.passwd
                                                                                                                                                                                                                                                                                                                                                                                                                     
#测试是否可以推送
[php86] #pwd
/ var / www / solitude
[php86] #touch test.html
[php86] #rsync -aprz /var/www/ web@172.16.251.85::httpd --password-file=/etc/rsyncd.passwd
[php86] # 没有报错
                                                                                                                                                                                                                                                                                                                                                                                                                     
到httpd上查看下
[httpd85] #ls solitude/
test.html
[httpd85] #测试正常的推送过来


四、安装inotify和rsync实现实时同步

1、在客户端安装inotify

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[php86] #yum -y install inotify-tools
                                                                                                                                                                                                                                                                                                                                                                     
#可以监控的事件;包含目录;详细请参考官方文档
IN_ACCESS,即文件被访问
IN_MODIFY,文件被 write
IN_ATTRIB,文件属性被修改,如 chmod、chown、touch 等
IN_CLOSE_WRITE,可写文件被 close
IN_CLOSE_NOWRITE,不可写文件被 close
IN_OPEN,文件被 open
IN_MOVED_FROM,文件被移走,如 mv
IN_MOVED_TO,文件被移来,如 mv、cp
IN_CREATE,创建新文件
IN_DELETE,文件被删除,如 rm
IN_DELETE_SELF,自删除,即一个可执行文件在执行时删除自己
IN_MOVE_SELF,自移动,即一个可执行文件在执行时移动自己
IN_UNMOUNT,宿主文件系统被 umount
IN_CLOSE,文件被关闭,等同于(IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
IN_MOVE,文件被移动,等同于(IN_MOVED_FROM | IN_MOVED_TO)


2、inotify-tools提供的两个命令行工具

inotifywait:通过inotify API等待被监控文件上的相应事件并返回监控结果,默认情况下,正常的结果返回至标准输出,诊断类的信息则返回至标准错误输出。它可以在监控到对应监控对象上指定的事件后退出,也可以进行持续性的监控。

inotifywatch:通过inotify API收集被监控文件或目录的相关事件并输出统计信息。

inotifywait用法:

-m, --monitor:inotifywait的默认动作是在监控至指定文件的特定事件发生一次后就退出了,而使用此选项则可实现持续性的监控;


-r, --recursive:递归监控指定目录下的所有文件,包括新建的文件或子目录;如果要监控的目录中文件数量巨大,则通常需要修改/proc/sys/fs/inotify/max_users_watchs内核参数,因为其默认值为8192。


-e <event>, --event <event>:指定要监控的特定事件,默认是监控所有的事件;此处<event>包括access, modify, attrib, close_write, close_nowirte, close, open, moved_to, moved_from, move, create, delete, delete_selt等;


--timefmt <fmt>:当在--format选项中使用%T时,--timefrt选项则可以用来指定自定义的符合strftime规范的时间格式,此时间格式可用的格式符可以通过strftime的手册页获取;--timefrt后常用的参数是'%d/%m/%y %H:%M';


--format <fmt>:自定义inotifywait的输出格式,如--format '%T %w %f';常用的格式符如下:

    %w:显示被监控文件的文件名;

    %f:如果发生某事件的对象是目录,则显示被监控目录的名字;默认显示为空串;

    %T:使用--timefmt选项中自定义的时间格式;


3、提供脚本实现实时同步


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
[php86] #vi /root/sync.sh
#!/bin/bash
#
src = / var / www /
des = httpd
web = 172.16 . 251.85
/ usr / bin / inotifywait  - mrq  - - timefmt  '%d/%m/%y %H:%M'  - - format  '%T %w%f%e'  \
- e modify,delete,create,attrib $src \
while  read files
  do
如有多台服务器可以用多条语句;好像也可以写在上面主机地址里;未测试
/ usr / bin / rsync  - avrpz  - - delete  - - progress $src web@$web::$des  - - password - file = / etc / rsyncd.passwd &>  / dev / null && \
echo  "$files have been pushed to all web servers."  >>  / var / log / websync.log
done
[php86] #chmod +x sync.sh
[php86] #/root/sync.sh &
                                                                                                                                                                                                                                         
#测试
[httpd85] #pwd
/ usr / local / apache / www
[httpd85] #ls soul/
[httpd85] #目录里什么也没有;去客户端操作
                                                                                                                                                                                                                                         
[php86] #pwd
/ var / www
[php86] #cd soul/
#下载一个wordpress到本目录
[php86] #tar xf wordpress-3.8.1-zh_CN.tar.gz
[php86] #mv wordpress/* ./
[php86] #cp wp-config-sample.php wp-config.php 到这里的步骤与前面安装LAMP都是一样的;所以这里不再赘述
                                                                                                                                                                                                                                         
#查看下日志
[php86] #cat /var/log/websync.log
29 / 03 / 14  22 : 52  / var / www / solitude / index.phpDELETE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / update.phpMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / update.phpATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / plugin - install.phpCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / plugin - install.phpMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / plugin - install.phpATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / theme - editor.phpCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / theme - editor.phpMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / theme - editor.phpATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / imagesCREATE,ISDIR have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / icons32 - vs - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / icons32 - vs - 2x .pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner - 2x .gifCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner - 2x .gifMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner - 2x .gifMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner - 2x .gifATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / loading.gifCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / loading.gifMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / loading.gifATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner.gifCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner.gifMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / spinner.gifATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / media - button - other.gifCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / media - button - other.gifMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / media - button - other.gifATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / media - button - 2x .pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / media - button - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / media - button - 2x .pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / mask.pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / mask.pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / mask.pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / stars.pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / stars.pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / stars.pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / lock.pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / lock.pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / lock.pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / sort.gifCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / sort.gifMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / sort.gifATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / align - left.pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / align - left.pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / align - left.pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / imgedit - icons - 2x .pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / imgedit - icons - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / imgedit - icons - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / imgedit - icons - 2x .pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / menu - vs - 2x .pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / menu - vs - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / menu - vs - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / menu - vs - 2x .pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / icons32 - 2x .pngCREATE have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / icons32 - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / icons32 - 2x .pngMODIFY have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / icons32 - 2x .pngATTRIB have been pushed to  all  web servers.
29 / 03 / 14  23 : 08  / var / www / soul / wordpress / wp - admin / images / lock - 2x .pngCREATE have been pushed to  all  web servers.
[php86] #    显示都已同步
                                                                                                                                                                                                                                         
#查看httpd服务器同步状况
[httpd85] #pwd
/ usr / local / apache / www / soul
[httpd85] #ls
index.php        wp - admin              wp - content         wp - login.php      xmlrpc.php
license.txt      wp - blog - header.php    wp - cron.php        wp - mail.php
readme.html      wp - comments - post.php  wp - includes        wp - settings.php
wordpress        wp - config - sample.php  wp - links - opml.php  wp - signup.php
wp - activate.php  wp - config.php         wp - load.php        wp - trackback.php
[httpd85] #

4、测试网站

wKiom1M26Gzh525VAAFTJ-HRbrs866.jpg

wKiom1M26H6z9Gy5AAFywLxHlgU359.jpgwKiom1M26a2Q2BdoAAF4I9-OSFE559.jpg

wKioL1M26ZjR1YHKAAEmpF-4rlU738.jpg

测试博客和mysql数据都是更新正常的。主要现在是可以同步更新服务了。自动监控。

如需要开机自动启动可以把脚本加到开机启动脚本中:

echo "/root/rsync.sh &" >> /etc/rc.local


到此;配置都已完成;实时同步和地址转换都已实现。



本文转自Mr_陈 51CTO博客,原文链接:http://blog.51cto.com/chenpipi/1386769,如需转载请自行联系原作者

相关文章

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等