一、简介

VMware-ESXI5.0中虚拟机通过vmware_fenceagent虚拟fence设备。根据Redhat官网资料,在RHEL5之后,vmware_fence agent因与第三方工具(VMware Perl API)信任关系而被替换为vmware_fence_soap agent

基于此处测试环境为ESXI5.0centos6.2,所以使用vmware_fence_soap agent虚拟fence设备。

二、环境

ESXI版本:5.0.0

OS版本:centos6.2 x86_64

wKiom1Mf_w_y2S0yAADzMo0Rx1A722.jpg

三、安装RHCS    (介于本文主要介绍fence设备,安装不做详细介绍)

yumgroupinstall "High Availability"

四、调试fence设备

查看主机状态

   fence_vmware_soap -a 172.26.184.252 -z -lroot -p internavi -n ha1 -o status

   如遇如下错误,请使用uuid查询虚拟机状态,high availabilityfence设备也是通过uuid查找设备

   Failed: Unable toobtain correct plug status or plug is not available

通过uuid查看主机状态

   fence_vmware_soap -a 172.26.184.251 -z -l root -p internavi -U564defee-542d-7f24-a283-eaa2f731d160 -o status

   如果返回Status: ON则表明fence设备正常。

查询uuid号

   fence_vmware_soap -a 172.26.188.251 -z -l root -pinternavi -o list

五、集群中fence设备配置示例

cluster.conf配置示例:

<?xml version="1.0"?>
<cluster config_version="12" name="apachecluster">
        <clusternodes>
                <clusternode name="ha1" nodeid="1">
                        <fence>
                                <method name="fence_ha1">
                                        <device action="off" name="esxi_fence2" port="ha1" ssl="on" uuid="564df590-d661-ad5d-bb18-36f21e8ea372"/>
                                </method>
                        </fence>
                </clusternode>
                <clusternode name="ha2" nodeid="2">
                        <fence>
                                <method name="fence_ha2">
                                        <device action="off" name="esxi_fence1" port="ha2" ssl="on" uuid="564defee-542d-7f24-a283-eaa2f731d160"/>
                                </method>
                        </fence>
                </clusternode>
        </clusternodes>
        <cman expected_votes="1" two_node="1"/>
        <fencedevices>
                <fencedevice agent="fence_vmware_soap" ipaddr="172.26.184.251" login="root" name="esxi_fence1" passwd="internavi"/>
                <fencedevice agent="fence_vmware_soap" ipaddr="172.26.184.252" login="root" name="esxi_fence2" passwd="t0mcatu5er"/>
        </fencedevices>
        <rm>
                <failoverdomains>
                        <failoverdomain name="FD" nofailback="1" ordered="1" restricted="0">
                                <failoverdomainnode name="ha1" priority="1"/>
                                <failoverdomainnode name="ha2" priority="2"/>
                        </failoverdomain>
                </failoverdomains>
                <resources>
                        <script file="/etc/init.d/httpd" name="httpd"/>
                        <ip address="172.26.188.225" monitor_link="on"/>
                </resources>
                <service domain="FD" exclusive="1" name="httpd" recovery="relocate">
                        <script ref="httpd"/>
                </service>
        </rm>
</cluster>