[ClusterLabs] 答复: 答复: How to create the stonith resource in virtualbox

范国腾 fanguoteng at highgo.com
Mon Feb 26 09:22:54 UTC 2018


Hi Marek and all,

I use the following command to create a stonith resource in virtualbox(centos7)which has no /dev/mapper/fence:
pcs stonith create scsi-stonith-device fence_scsi devices=/dev/mapper/fence pcmk_monitor_action=metadata pcmk_reboot_action=off pcmk_host_list="node1 node2" meta provides=unfencing;


The stonith resource status could be “started” in 2017 and I think that it is because I use the metadata. But when I install a new VM this year and create the stonith again using the same command. It always be stopped status.

I try many times and here are current situation:

(1)   I created a cluster in 2017 in VM using the following command in CENTOS7. The stonith status is started until now.

(2)   I created a cluster today in VM using the following command in CENTOS7. The stonith status is always stopped.

(3)   I created a cluster today in VM using the following command in REDHAT7. The stonith status could be started.

I compare the /usr/sbin/fence_scsi file in different node and it  has no logic change.

Why could the Stonith resource could be started? How should I debug it?

Here is my command:
systemctl stop firewalld;chkconfig firewalld off;

yum install -y corosync pacemaker pcs gfs2-utils lvm2-cluster *scsi* python-clufter;

pcs cluster auth node1 node2 node3 -u hacluster;pcs cluster setup --name cluster_pgsql node1 node2 node3;pcs cluster start --all;pcs property set no-quorum-policy=freeze;pcs property set stonith-enabled=true;

pcs stonith create scsi-stonith-device fence_scsi devices=/dev/mapper/fence pcmk_monitor_action=metadata pcmk_reboot_action=off pcmk_host_list="node1 node2" meta provides=unfencing;


Here is the log:
Feb 26 03:55:08 db1 crmd[2215]:  notice: Requesting fencing (on) of node db1
Feb 26 03:55:08 db1 stonith-ng[2211]:  notice: Client crmd.2215.c5d11cbe wants to fence (on) 'db2' with device '(any)'
Feb 26 03:55:08 db1 stonith-ng[2211]:  notice: Requesting peer fencing (on) of db2
Feb 26 03:55:08 db1 stonith-ng[2211]:  notice: Client crmd.2215.c5d11cbe wants to fence (on) 'db1' with device '(any)'
Feb 26 03:55:08 db1 stonith-ng[2211]:  notice: Requesting peer fencing (on) of db1
Feb 26 03:55:08 db1 stonith-ng[2211]:  notice: scsi-stonith-device can fence (on) db1: static-list
Feb 26 03:55:08 db1 stonith-ng[2211]:  notice: scsi-stonith-device can fence (on) db1: static-list
Feb 26 03:55:08 db1 fence_scsi: Failed: device "/dev/mapper/fence" does not exist
Feb 26 03:55:08 db1 fence_scsi: Please use '-h' for usage
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [ WARNING:root:Parse error: Ignoring unknown option 'port=db1' ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [  ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [ ERROR:root:Failed: device "/dev/mapper/fence" does not exist ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [  ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [ Failed: device "/dev/mapper/fence" does not exist ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [  ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [ ERROR:root:Please use '-h' for usage ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [  ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [ Please use '-h' for usage ]
Feb 26 03:55:08 db1 stonith-ng[2211]: warning: fence_scsi[9072] stderr: [  ]
Feb 26 03:59:11 db1 rsyslogd: [origin software="rsyslogd" swVersion="7.4.7" x-pid="627" x-info="http://www.rsyslog.com"] start
Feb 26 03:59:12 db1 rsyslogd-2027: imjournal: fscanf on state file `/var/lib/rsyslog/imjournal.state' failed
[try http://www.rsyslog.com/e/2027 ]

发件人: 范国腾
发送时间: 2018年2月11日 15:43
收件人: Cluster Labs - All topics related to open-source clustering welcomed <users at clusterlabs.org>
主题: 答复: [ClusterLabs] 答复: How to create the stonith resource in virtualbox

Marek,

Thank you very much for your help. I add the “pcmk_monitor_action=metadata”and the stonith could work now.

Thanks


发件人: Users [mailto:users-bounces at clusterlabs.org] 代表 Marek Grac
发送时间: 2018年2月9日 16:38
收件人: Cluster Labs - All topics related to open-source clustering welcomed <users at clusterlabs.org<mailto:users at clusterlabs.org>>
主题: Re: [ClusterLabs] 答复: How to create the stonith resource in virtualbox

Hi,

for fence_vbox take a look at my older blogpost> https://ox.sk/howto-fence-vbox-cdd3da374ecd

if all you need is to have fencing in a state when dlm works and you promise that you will never have real data on it. There is an easy hack, it really does not matter which fence agent you use. All we care about is if action 'monitor' works, so add option>

pcmk_monitor_action=metadata

It means that instead of monitor action, you will use action 'metadata' which just prints XML metadata and succeed.

m,

On Fri, Feb 9, 2018 at 6:33 AM, 范国腾 <fanguoteng at highgo.com<mailto:fanguoteng at highgo.com>> wrote:
Thank Klaus,

The information is very helpful. I try to study the fence_vbox and the fence_sdb.

In our test lab, we use ipmi as the stonith. But I want to setup a simulator environment in my laptop. So I just need the stonith resource in start state so that I could create dlm and clvm resource.And I don't need it relally work. Do anybody have other suggestion?


-----邮件原件-----
发件人: Users [mailto:users-bounces at clusterlabs.org<mailto:users-bounces at clusterlabs.org>] 代表 Klaus Wenninger
发送时间: 2018年2月9日 1:11
收件人: users at clusterlabs.org<mailto:users at clusterlabs.org>
主题: Re: [ClusterLabs] How to create the stonith resource in virtualbox

On 02/08/2018 02:05 PM, Andrei Borzenkov wrote:
> On Thu, Feb 8, 2018 at 5:51 AM, 范国腾 <fanguoteng at highgo.com<mailto:fanguoteng at highgo.com>> wrote:
>> Hello,
>>
>> I setup the pacemaker cluster using virtualbox. There are three nodes. The OS is centos7, the /dev/sdb is the shared storage(three nodes use the same disk file).
>>
>> (1) At first, I create the stonith using this command:
>> pcs stonith create scsi-stonith-device fence_scsi
>> devices=/dev/mapper/fence pcmk_monitor_action=metadata
>> pcmk_reboot_action=off pcmk_host_list="db7-1 db7-2 db7-3" meta
>> provides=unfencing;
>>
>> I know the VM not have the /dev/mapper/fence. But sometimes the stonith resource able to start, sometimes not. Don't know why. It is not stable.
>>
> It probably tries to check resource and fails. State of stonith
> resource is irrelevant for actual fencing operation (this resource is
> only used for periodical check, not for fencing itself).
>
>> (2) Then I use the following command to setup stonith using the shared disk /dev/sdb:
>> pcs stonith create scsi-shooter fence_scsi
>> devices=/dev/disk/by-id/ata-VBOX_HARDDISK_VBc833e6c6-af12c936 meta
>> provides=unfencing
>>
>> But the stonith always be stopped and the log show:
>> Feb  7 15:45:53 db7-1 stonith-ng[8166]: warning: fence_scsi[8197]
>> stderr: [ Failed: nodename or key is required ]
>>
> Well, you need to provide what is missing - your command did not
> specify any host.
>
>> Could anyone help tell what is the correct command to setup the stonith in VM and centos? Is there any document to introduce this so that I could study it?

I personally don't have any experience setting up a pacemaker-cluster in vbox.

Thus I'm limited to giving rather general advice.

What you might have to assure together with fence_scsi is if the scsi-emulation vbox offers lives up to the requirements of fence_scsi.
I've read about troubles in a posting back from 2015. The guy then went for using scsi via iSCSI.

Otherwise you could look for alternatives to fence_scsi.

One might be fence_vbox. It doesn't come with centos so far iirc but the upstream repo on github has it.
Fencing via the hypervisor is in general not a bad idea when it comes to clusters running in VMs (If you can live with the boundary conditions like giving certain credentials to the VMs that allow communication with the hypervisor.).
There was some discussion about fence_vbox on the clusterlabs-list a couple of months ago. iirc there had been issues with using windows as a host for vbox - but I guess they were fixed in the course of this discussion.

Another way of doing fencing via a shared disk is fence_sbd (available in centos) - although quite different from how fence_scsi is using the disk. One difference that might be helpful here is that it has less requirements on which disk-infrastructure is emulated.
On the other hand it is strongly advised for sbd in general to use a good watchdog device (one that brings down your machine - virtual or physical - in a very reliable manner). And afaik the only watchdog-device available inside a vbox VM is softdog that doesn't meet this requirement too well as it relies on the kernel running in the VM to be at least partially functional.

Sorry for not being able to help in a more specific way but I would be interested in which ways of fencing people are using when it comes to clusters based on vbox VMs myself ;-)

Regards,
Klaus
>>
>>
>> Thanks
>>
>>
>> Here is the cluster status:
>> [root at db7-1 ~]# pcs status
>> Cluster name: cluster_pgsql
>> Stack: corosync
>> Current DC: db7-2 (version 1.1.16-12.el7_4.7-94ff4df) - partition
>> with quorum Last updated: Wed Feb  7 16:27:13 2018 Last change: Wed
>> Feb  7 15:42:38 2018 by root via cibadmin on db7-1
>>
>> 3 nodes configured
>> 1 resource configured
>>
>> Online: [ db7-1 db7-2 db7-3 ]
>>
>> Full list of resources:
>>
>>  scsi-shooter   (stonith:fence_scsi):   Stopped
>>
>> Daemon Status:
>>   corosync: active/disabled
>>   pacemaker: active/disabled
>>   pcsd: active/enabled
>> _______________________________________________
>> Users mailing list: Users at clusterlabs.org<mailto:Users at clusterlabs.org>
>> http://lists.clusterlabs.org/mailman/listinfo/users
>>
>> Project Home: http://www.clusterlabs.org Getting started:
>> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
>> Bugs: http://bugs.clusterlabs.org
> _______________________________________________
> Users mailing list: Users at clusterlabs.org<mailto:Users at clusterlabs.org>
> http://lists.clusterlabs.org/mailman/listinfo/users
>
> Project Home: http://www.clusterlabs.org Getting started:
> http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
> Bugs: http://bugs.clusterlabs.org

_______________________________________________
Users mailing list: Users at clusterlabs.org<mailto:Users at clusterlabs.org> http://lists.clusterlabs.org/mailman/listinfo/users

Project Home: http://www.clusterlabs.org Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org
_______________________________________________
Users mailing list: Users at clusterlabs.org<mailto:Users at clusterlabs.org>
http://lists.clusterlabs.org/mailman/listinfo/users

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clusterlabs.org/pipermail/users/attachments/20180226/3bf42dcb/attachment-0001.html>


More information about the Users mailing list