标签:windows azure下apache高可用服务配置介绍
pWindows Azure下Apache高可用服务配置介绍/p pAzure现在不是一个什么新鲜话题了,但可以说Azure的功能还在逐渐增加,包括性能上的优化,具体就不多介绍了,近期呢闲着没事,就尝试在Azure上部署Apache服务的高可用性部署,如果在本地部署Apache服务的高可用性的话,会用到LVS+Keepalived等服务来实现Apache的高可用性配置,如果我们将Apache服务部署到windows azure上的话,就省去了LVS+Keepalived的配置,所以相对比较简单一点。在Azure上部署高可用性配置的基本原理为,将多台VM配置到同一个云服务下(一个云服务代表一个公网IP),然后配置相应的端点高可用性和负载平衡器就可以实现了,Apache和Nginx的配置一样,具体见下:/p p环境介绍:/p pHostname:Webserver01.iternalsoft.com/p pIP:10.10.1.20/p pRole:Apache Server/p pHostname:Webserver02.iternalsoft.com/p pIP:10.10.1.21/p pRole:Apache Server/p pCloud Service:Iternal/p p我们选择从库中选择Centos7/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image002" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image002" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1128" height="636" //a/p p虚拟机的hostname:Webserver01/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image004" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image004" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1105" height="630" //a/p p选择已经存在的云服务即可;可根据自己的环境来进行配置/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image006" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image006" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1073" height="634" //a/p p开始创建vm/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image008" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image008" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1159" height="620" //a/p p创建完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image010" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image010" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1162" height="609" //a/p p接下来我们查看配置/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image012" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image012" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1156" height="640" //a/p p然后我们按照以上的方法进行部署第二台服务器。/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image014" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image014" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1163" height="637" //a/p p在此我们需要注意,我们需要将该VM和上面的VM放在同一个云服务下可实现高可用性/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image016" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image016" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1016" height="648" //a/p p开始配置/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image018" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image018" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1171" height="614" //a/p p配置完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image020" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image020" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1161" height="605" //a/p p接下来我们查看网络配置信息,两台VM使用的是同一个网络信息/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image022" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image022" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1163" height="559" //a/p p然后我们在同一云服务下运行两台vm/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image024" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image024" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1154" height="601" //a/p p接下来就是开始配置可用性集了/p p我们单击进入服务器配置----配置---可用性集合/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image026" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image026" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1168" height="610" //a/p p选择创建可用性集,然后定义可用性集名称/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image028" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image028" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1152" height="554" //a/p p开始创建可用性集/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image030" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image030" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1163" height="606" //a/p p配置完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image032" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image032" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1160" height="603" //a/p p接着我们同样将webserver02加入到该可用性集即可/p p我们选择-刚才新建的可用性集合--保存即可加入到可用性集合中/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image034" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image034" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1163" height="612" //a/p p可用性集合部署配置完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image036" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image036" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1158" height="602" //a/p p可用性配置完成后,我们接下来配置开发端口了-----终端/p p单击vm---终端店---添加/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image038" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image038" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1152" height="610" //a/p p首先添加独立的终结点/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image040" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image040" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1154" height="598" //a/p p在此我们需要选择需要开发的端口--终结点---HTTP/p p注:需要勾选创建负载均衡节点/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image042" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image042" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1154" height="601" //a/p p定义负载均衡名/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image044" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image044" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1094" height="590" //a/p p终结点负载均衡创建完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image046" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image046" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1167" height="600" //a/p p我们按照同样的方法需要创建HTTPS负载均衡服务/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image048" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image048" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1168" height="600" //a/p p我们所需服务的对应的端口已经创建了负载平衡集/p pHTTPS 443/p pHTTP 80/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image050" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image050" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1166" height="607" //a/p p接下来就是配置webserver02了,我们需要按照同样的方法操作,唯一区别就是webserver02只需要添加到刚才新建的负载平衡集合中即可/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image052" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image052" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1156" height="606" //a/p p我们选择将中街店添加到现有的负载平衡集中/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image054" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image054" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1139" height="593" //a/p p终结点负载平衡添加完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image056" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image056" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1160" height="568" //a/p p我们按照同样的方法将HTTPS也添加到已存在的负载平衡集中/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image058" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image058" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1099" height="590" //a/p p服务器的负载平衡集添加完成/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image060" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image060" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1155" height="609" //a/p p我们可以查看云服务状态/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image062" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image062" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1165" height="560" //a/p p接下来我们就使用xshell连接到两台服务器上开始安装及配置服务/p p连接前我们需要确认的是,如果从外部ssh的话需要确认端口,因为两台vm使用的是同一个云服务,ssh的默认端口是22,所以我们需要确认端口信息/p pWebserver01的外网ssh端口为22/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image064" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image064" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1140" height="543" //a/p pWebserver02的ssh外网端口为51658/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image066" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image066" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1132" height="563" //a/p p通过以上信息,我们就可以ssh登录了/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image068" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image068" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1158" height="645" //a/p p登录的第一件事是我们需要启用root管理员,因为默认azure是没有启用root的,所以我们需要启用root管理员信息/p pSudo -su root/p p输入gavin默认账户的信息进行确认/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image070" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image070" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1021" height="180" //a/p p然后我们passwd root 修改root的密码进行启用/p pPasswd root/p pNew pwd/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image072" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image072" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1057" height="190" //a/p p这样我们就可以使用root进行登录了/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image074" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image074" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1029" height="571" //a/p proot登录后,我们接下来就是修改计算机名了/p pHostnamectl set-hostname web-server01/p p关闭防火墙/p pSystemctl stop firewalld/p pSystemctl disable firewalld/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image076" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image076" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="973" height="486" //a/p p关闭性能调试/p pVim /etc/selinux/config/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image078" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image078" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="881" height="531" //a/p p如果需要以上服务生效的话我们需要重启系统/p pReboot/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image080" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image080" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="895" height="516" //a/p p接着我们按照以上方法需要修改webserver02的相关信息/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image082" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image082" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="879" height="416" //a/p p接下来就是安装apache服务了/p pYum install -y httpd/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image084" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image084" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1265" height="707" //a/p p安装完成后,可以通过rpm查看httpd的版本,我们查看到已安装的是httpd-2.4.6-31/p prpm -qa | grep httpd/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image086" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image086" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1174" height="126" //a/p p我们首先是备份httpd.conf的文件,因为我们需要修改httpd.conf的文件,所以建议操作前备份一下/p pCp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image088" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image088" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1051" height="151" //a/p pLs /etc/httpd/conf//p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image090" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image090" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="864" height="55" //a/p p启动httpd服务/p pSystemctl start httpd/p pNetstat -anlpt/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image092" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image092" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1263" height="343" //a/p p接下来我们就尝试访问web服务/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image094" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image094" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1272" height="625" //a/p p接下来为了更好的演示页面,所以我们修改默认页面内容:/p p我们都知道apache默认的访问页面在/p p/etc/httpd/conf.d/welcome.conf/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image096" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image096" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1071" height="562" //a/p p接下来我们创建一个默认的index.html文件来定义显示内容/p pCd /var/www/html/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image098" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image098" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="923" height="59" //a/p p该默认路径没有index.html文件,所以我们要创建一个,然后编辑内容/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image100" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image100" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1058" height="542" //a/p pVim index.html/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image102" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image102" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1066" height="517" //a/p p保存后,我们重启httpd服务,继续访问/p pSystemctl restart httpd/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image104" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image104" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="736" height="47" //a/p p继续访问测试,结果是可以的/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image106" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image106" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1048" height="469" //a/p p接着我们开始配置webserver02的以上信息/p p我们yum install -y httpd/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image108" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image108" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1282" height="661" //a/p p然后我们在server01上运行scp讲index.html文件拷贝到server02上/p pscp/var/www/html/index.html 10.10.10.5:/var/www/html/index.html/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image110" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image110" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1270" height="460" //a/p p接下来我们在webserver02上修改显示信息/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image112" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image112" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1155" height="557" //a/p p保存后,我们就重启服务/p pSystemctl restart httpd /p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image114" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image114" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1035" height="460" //a/p p接着来我们测试高可用性/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image116" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image116" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1148" height="500" //a/p p接下来我们进行两次高可用测试/p p首先我们在server01上停止httpd服务,然后尝试访问/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image118" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image118" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1199" height="471" //a/p p继续访问呢;/p p由于server01的httpd停止,所以会访问server02的信息/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image120" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image120" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1028" height="440" //a/p p现在我们将server01的httpd启用,然后将server02的httpd停止/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image122" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image122" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="689" height="352" //a/p p继续访问测试;会跳转到server01的配置页面/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image124" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image124" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="890" height="428" //a/p p在此windowsazure下的高可用配置介绍完成,/p p最后我们再说说azure上可以实现对可用性服务的缩放服务,所谓的缩放服务就是对高可用群集服务进行停机维护,当服务在满负载的情况下会运行,服务不高的时候会自动停机来节省费用/p p因为在windows azure上定义高可用性集就是所谓的多台vm对应一个云服务,所以我们配置缩放需要在云服务下进行配置/p p单击云服务----缩放/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image126" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image126" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1121" height="606" //a/p p我们可以看见缩放可以根据:CPU、队列进行缩放配置;当然我们也可以通过时间段进行缩放配置呢:/p p1.如果根据时间进行缩放的话,可以定义一个时间段对某个服务进行停机,然后经过定义的时间段会自动启动/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image128" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image128" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1135" height="633" //a/p p2.通过CPU定义的话,如果CPU超过定义值,服务器具会自动启动/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image130" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; margin: 0px; padding-right: 0px" border="0" alt="clip_image130" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1166" height="612" //a/p p3.通过队列进行定义,如果队列超过了指定的值,服务器也会自动启动/p pa href="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif"img title="clip_image132" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image132" src="http://s3.51cto.com//wyfs02/M01/75/C1/wKiom1ZBuDDCD203AAflb-_07c4064.gif" width="1156" height="600" //a/p p如果要配置Apache SSL的相关配置的话,请参考以下:/p pa title="http://gaowenlong.blog.51cto.com/451336/1671672" href="http://gaowenlong.blog.51cto.com/451336/1671672"http://gaowenlong.blog.51cto.com/451336/1671672/a/p
本文出自 “高文龙” 博客,谢绝转载!
标签:windows azure下apache高可用服务配置介绍
原文地址:http://gaowenlong.blog.51cto.com/451336/1711602