6.6. フェンスデバイスの作成

ほとんどのデフォルト設定では、GCP インスタンス名と RHEL ホスト名は同じです。

クラスター内の任意のノードからフェンシングを設定するには、以下の手順を実施します。

手順

  1. クラスターの任意のノードから GCP インスタンス名を取得します。出力には、インスタンスの内部 ID も表示されることに注意してください。

    # fence_gce --zone _gcp_ _region_ --project= _gcp_ _project_ -o list

    たとえば、以下のようになります。

    [root@rhel71-node-01 ~]# fence_gce --zone us-west1-b --project=rhel-ha-testing-on-gcp -o list
    44358**********3181,InstanceName-3
    40819**********6811,InstanceName-1
    71736**********3341,InstanceName-2
  2. フェンスデバイスを作成します。pcmk_host-name コマンドを使用して、RHEL ホスト名をインスタンス ID にマッピングします。

    # pcs stonith create _clusterfence_ fence_gce pcmk_host_map=_pcmk-hpst-map_ fence_gce zone=_gcp-zone_ project=_gcpproject_

    たとえば、以下のようになります。

    [root@node01 ~]# pcs stonith create fencegce fence_gce pcmk_host_map="node01:node01-vm;node02:node02-vm;node03:node03-vm" project=hacluster zone=us-east1-b

検証手順

  1. 他のノードのいずれかに対してフェンスエージェントをテストします。

    # pcs stonith fence gcp nodename
  2. ステータスを確認して、ノードがフェンスされていることを確認します。

    # watch pcs status

たとえば、以下のようになります。

[root@node01 ~]# watch pcs status
Cluster name: gcp-cluster
Stack: corosync
Current DC: rhel71-node-02 (version 1.1.18-11.el7_5.3-2b07d5c5a9) - partition with quorum
Last updated: Fri Jul 27 12:53:25 2018
Last change: Fri Jul 27 12:51:43 2018 by root via cibadmin on rhel71-node-01

3 nodes configured
3 resources configured

Online: [ rhel71-node-01 rhel71-node-02 rhel71-node-03 ]

Full list of resources:

us-east1-b-fence    (stonith:fence_gce):    Started rhel71-node-01

Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled