SQL Server 2017 AlwaysOn on Linux 配置和维护(18)

2.6.2使用Pacemaker修改CIB

在Windows平台,WSFC本身支持多子网,通过对IP地址的OR依赖来处理多IP地址。

在Linux平台,没有OR依赖,但可以通过使用Pacemaker修改CIB来支持多子网。简单的通过Pacemaker命令修改一个资源做不到,需要修改群集信息库(CIB)。CIB是一个Pacemaker配置用的XML文件。

clip_image002


导出CIB

sudo pcs cluster cib <filename>


编辑CIB文件

在<resources>部分,会看到尾AG或FCI创建的各种资源。找到与IP地址相关的资源。为第二个IP地址,在已存在IP地址的上面或下面,但在<operations>之前,添加

<instance attributes>部分。语法类似于:
<instance attributes id="<NameForAttribute>" score="<Score>">
<rule id="<RuleName>" score="INFINITY">
<expression id="<ExpressionName>" attribute="\#uname" operation="eq" value="<NodeNameInSubnet2>" />
</rule>
<nvpair id="<NameForSecondIP>" name="ip" value="<IPAddress>"/>
<nvpair id="<NameForSecondIPNetmask>" name="cidr\_netmask" value="<Netmask>"/>
</instance attributes>

例如:

<instance attributes id="Node3-2nd-IP" score="2">
<rule id="Subnet2-IP" score="INFINITY">
<expression id="Subnet2-Node" attribute="\#uname" operation="eq" value="Node3" />
</rule>
<nvpair id="IP-In-Subnet-2" name="ip" value="192.168.2.102"/>
<nvpair id="Netmask-For-IP2" name="cidr\_netmask" value="24" />
</instance attributes>

clip_image004


导入CIB并重新配置Pacemaker

sudo pcs cluster cib-push <filename>


检查并验证故障转移

1.PING在Pacemaker中与IP地址资源相关的DNS名。它应该返回承载AG或FCI的当前子网相关的IP地址。

2.故障转移AG或FCI到其他子网。

3.在AG或FCI完全在线后,PING与IP地址相关的DNS名。它应该返回第二个子网的IP地址。

4.如果需要,故障转移AG或FCI回原来的子网。

猜你喜欢

转载自blog.51cto.com/ultrasql/2178000
今日推荐