本次试验主要是有如下功能:
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(宿主机)
首先需要搭建一个LAMP环境;这里就不在赘述;NFS实现LAMP分离多服务器同步更新服务都有介绍。下面就直接从未介绍到的开始。
一、配置DNS的view模式
DNS的view模式可以使不同的网络解析到不同的IP地址。以此可以提高网络性能。
1、安装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文件;暂时可以不用管
2、配置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"; }; };
3、提供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服务器的地址
二、配置防火墙服务器
1、首先配置两个地址;并开启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
2、把内网网段的网关指向本机内网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
3、配置外网IP和firewall地址转换
由于是测试;所以外网需要指定一个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
测试解析访问都已正常。且地址是外网地址。
三、配置rsync服务器
1、配置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 #只写 host allow = 172.16.251.86 #允许的主机;白名单;这里使用的是PHP;也可以定义为其他 host deny = * #黑名单 list = false #是否允许以列表显示其中内容 uid = root #如全局意思一样;这里为了方便使用root;不建议 gid = root auth users = web #认证的用户 secrets file = /etc/rsyncd.passwd #密码文件
2、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
3、配置密码文件和客户端地址
[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 -apz /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
[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提供的两个命令行工具
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‘;常用的格式符如下:
3、提供脚本实现实时同步
[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 -avpz --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 #测试 [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、测试网站
测试博客和mysql数据都是更新正常的。主要现在是可以同步更新服务了。自动监控。
如需要开机自动启动可以把脚本加到开机启动脚本中:
echo "/root/rsync.sh &" >> /etc/rc.local
到此;配置都已完成;实时同步和地址转换都已实现。
如有错误;恳请纠正。
本文出自 “Soul” 博客,请务必保留此出处http://chenpipi.blog.51cto.com/8563610/1386769
rsync+inotify+firewall+lamp实现自动同步等相关功能,布布扣,bubuko.com
rsync+inotify+firewall+lamp实现自动同步等相关功能
原文:http://chenpipi.blog.51cto.com/8563610/1386769