rsync+inotify+firewall+lamp實現自動同步等相關功能

本次試驗主要是有以下功能:php

一、rsync+inotify實現自動推送;同步更新;html

二、firewall能夠進行地址轉換以及控制訪問;python

三、DNS服務能夠對不一樣的客戶端解析到不一樣的地址;outter client解析地址爲1.110;inter client解析地址爲251.85。mysql


大體規劃以下:web

dns server:172.16.251.84sql

lamp:
shell

   httpd:172.16.251.85
apache

   php:  172.16.251.86
vim

   mysql:172.16.251.87bash

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並分離爲多臺服務器都有介紹。下面就直接從未介紹到的開始。


1、配置DNS的view模式

DNS的view模式可使不一樣的網絡解析到不一樣的IP地址。以此能夠提升網絡性能。

一、安裝DNS服務器

[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文件;暫時能夠不用管


二、配置view來解析不一樣IP

[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";
};
};


三、提供zone文件

[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服務器的地址


2、配置防火牆服務器

一、首先配置兩個地址;並開啓forward轉發功能

[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


二、把內網網段的網關指向本機內網IP

#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


三、配置外網IP和firewall地址轉換

wKioL1M2w-PS2kw7AAGg2mm1rwE725.jpg

因爲是測試;因此外網須要指定一個DNS服務器解析的;因此這裏指定到了firewall這臺機器的外網IP;不然沒法解析的;配置firewall的地址轉換規則

[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

測試解析訪問都已正常。且地址是外網地址。


3、配置rsync服務器

一、配置httpd爲rsync服務器

[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 #密碼文件


二、rsync的選項

-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


三、配置密碼文件和客戶端地址

[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]#測試正常的推送過來


4、安裝inotify和rsync實現實時同步

一、在客戶端安裝inotify

[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)


二、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選項中自定義的時間格式;


三、提供腳本實現實時同步


[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/p_w_picpathsCREATE,ISDIR have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/icons32-vs-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/icons32-vs-2x.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner-2x.gifCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner-2x.gifMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner-2x.gifMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner-2x.gifATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/loading.gifCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/loading.gifMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/loading.gifATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner.gifCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner.gifMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/spinner.gifATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/media-button-other.gifCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/media-button-other.gifMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/media-button-other.gifATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/media-button-2x.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/media-button-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/media-button-2x.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/mask.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/mask.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/mask.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/stars.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/stars.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/stars.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/lock.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/lock.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/lock.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/sort.gifCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/sort.gifMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/sort.gifATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/align-left.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/align-left.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/align-left.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/imgedit-icons-2x.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/imgedit-icons-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/imgedit-icons-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/imgedit-icons-2x.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/menu-vs-2x.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/menu-vs-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/menu-vs-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/menu-vs-2x.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/icons32-2x.pngCREATE have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/icons32-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/icons32-2x.pngMODIFY have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/icons32-2x.pngATTRIB have been pushed to all web servers.
29/03/14 23:08 /var/www/soul/wordpress/wp-admin/p_w_picpaths/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]#

四、測試網站

wKiom1M26Gzh525VAAFTJ-HRbrs866.jpg

wKiom1M26H6z9Gy5AAFywLxHlgU359.jpgwKiom1M26a2Q2BdoAAF4I9-OSFE559.jpg

wKioL1M26ZjR1YHKAAEmpF-4rlU738.jpg

測試博客和mysql數據都是更新正常的。主要如今是能夠同步更新服務了。自動監控。

如須要開機自動啓動能夠把腳本加到開機啓動腳本中:

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


到此;配置都已完成;實時同步和地址轉換都已實現。





若有錯誤;懇請糾正。

相關文章
相關標籤/搜索