背景:一些热门站点会有用户进行大量访问,当达到一定量时会产生拥堵或宕机,那么该服务器就无法再对外提供服务。因此一些企业会为站点采用一些技术手段,实现当主服务器发生故障无法对外服务,此使备用服务器接管主服务器的职责和任务对外提供服务,这就是故障转移。
<blockquote>
<p>
相关知识
</p>
<p>
一、故障转移
</p>
<p style="text-indent: 50px;">
故障转移集群(Failover Cluster)是一种高可用的基础结构层。即由多台计算机组成,每台计算机作为一个冗余节点,防止某节点掉线、故障或损坏。
</p>
<p>
二、条件
</p>
<p>
1、成员服务器加入域
</p>
<p>
2、利用两个磁盘(仲裁磁盘、数据存储磁盘)
</p>
<p>
3、3张网卡(1个连接后端存储、1个为外网提供服务、1个故障检测网卡【心跳线】)
</p>
<p>
三、工作过程
</p>
<p>
1、主服务器发生故障,故障检测网卡停止发送数据包
</p>
<p>
2、备用服务器在一定时间内未收到数据包,认定主服务器发生故障,发起主服务器决策投票。备用服务器向SAN存储申请占用仲裁磁盘
</p>
<p>
3、备用服务器担任主服务器功能对外提供服务
</p>
</blockquote>
<blockquote>
<p>
项目配置
</p>
<table style="width: 500px;" border="1" cellspacing="1" cellpadding="1">
<tr>
<td style="width: 240px;">
AD-Storage
</td>
<td style="width: 258px;">
192.168.20.222
</td>
<td style="width: 258px;">
</td>
</tr>
<tr>
<td style="width: 240px;">
Web1
</td>
<td style="width: 258px;">
192.168.20.100
</td>
<td style="width: 258px;" colspan="1" rowspan="2">
集群IP:192.168.20.110
</td>
</tr>
<tr>
<td style="width: 240px;">
Web2
</td>
<td style="width: 258px;">
192.168.20.200
</td>
</tr>
</table>
<p>
一、基于IP SAN部署Web服务器
</p>
<p>
1、AD/Storage-Server
</p>
<p>
(1)安装域服务,并将Web1和Web2加入同一域中
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425230051948.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="764" height="292" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425230317754.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="670" height="274" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425233036496.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="638" height="265" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425233234284.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="539" height="349" />
</p>
<p>
(2)配置存储池
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425234348368.png" alt="" width="732" height="157" />
</p>
<p>
(3)安装iSCSI服务
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425234939404.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="755" height="451" />
</p>
<p>
(4)创建两个的虚拟磁盘(Arbitration:5G、Web-data:10G)
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190425235537759.png" alt="" width="555" height="193" />
</p>
<p>
(5)添加访问服务器
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426000851610.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="698" height="307" />
</p>
<p>
(6)同样步骤创建Web-data虚拟磁盘
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426001007365.png" alt="" width="754" height="76" />
</p>
<p>
2、Web1
</p>
<p>
(1)链接AD/Storage-Server上的两个虚拟磁盘
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426001129289.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="478" height="483" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426001209453.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="471" height="418" />
</p>
<p>
(2)格式化
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426001704535.png" alt="" width="527" height="180" />
</p>
<p>
(3)创建Web目录并编辑首页文件
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426001925344.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="622" height="338" />
</p>
<p>
(4)安装IIS服务
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426002134170.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="751" height="340" />
</p>
<p>
(5)创建站点
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426002421761.png" alt="" width="427" height="190" />
</p>
<p>
(6)验证
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426002343921.png" alt="" width="385" height="158" />
</p>
<p>
3、Web2
</p>
<p>
(1)按照Web1上的步骤进行
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/2019042600271948.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="560" height="359" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426002901484.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="437" height="402" />
</p>
<p>
二、创建故障转移集群
</p>
<p>
1、分别在Web1、Web2上安装【故障转移集群】
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426003215625.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="783" height="400" />
</p>
<p>
2、在Web1上打开【故障转移集群管理器】,创建集群,添加两台Web服务器
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426011136349.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="659" height="301" />
</p>
<p>
3、进行测试
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426011222149.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="652" height="294" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426011312741.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="658" height="340" />
</p>
<p>
4、填写集群名称,勾选网络并填写IP地址
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426011748766.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="632" height="297" />
</p>
<p>
5、创建完成
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426011853265.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="657" height="404" />
</p>
<p>
三、验证
</p>
<p>
1、打开【故障转移集群管理器】,查看节点状况
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426011923810.png" alt="" width="580" height="86" />
</p>
<p>
2、在【存储】下的【磁盘】中可看到仲裁磁盘和数据磁盘的隶属关系
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426012209775.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="782" height="325" />
</p>
<p>
3、分别查看Web服务器上的磁盘状况
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426012056260.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="710" height="592" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426013846583.png" alt="" width="536" height="132" />
</p>
<p>
4、断掉主服务器(Web1)
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426014155239.png" alt="" width="595" height="149" />
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426014218837.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="775" height="278" />
</p>
<p>
5、测试访问情况
</p>
<p style="text-align: center;">
<img loading="lazy" decoding="async" class="has" src="https://img-blog.csdnimg.cn/20190426014024464.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQyMTY4NTc1,size_16,color_FFFFFF,t_70" alt="" width="762" height="362" />
</p>
</blockquote>