第17章 コントローラーノードのフェンシング
フェンシングとは、クラスターとそのリソースを保護するために、障害が発生したノードを分離するプロセスのことです。フェンシングがないと、障害のあるノードが原因でクラスター内のデータが破損する可能性があります。
director は、Pacemaker を使用して、高可用性のコントローラーノードクラスターを提供します。Pacemaker は、障害の発生したノードをフェンシングするのに STONITH というプロセスを使用します。STONITH はデフォルトでは無効化されているため、Pacemaker がクラスター内の各ノードの電源管理を制御できるように手動で設定する必要があります。
17.1. 前提条件の確認
オーバークラウドでフェンシングを設定するには、オーバークラウドがすでにデプロイ済みで稼働状態である必要があります。以下の手順では、デプロイメント内の Pacemaker と STONITH の状態を確認します。
-
director 上の
stackユーザーから、heat-adminユーザーとして各ノードにログインします。オーバークラウドを作成すると自動的にstackユーザーの SSH キーが各ノードのheat-adminにコピーされます。 実行中のクラスターがあることを確認します。
$ sudo pcs status Cluster name: openstackHA Last updated: Wed Jun 24 12:40:27 2015 Last change: Wed Jun 24 11:36:18 2015 Stack: corosync Current DC: lb-c1a2 (2) - partition with quorum Version: 1.1.12-a14efad 3 Nodes configured 141 Resources configured
STONITH が無効化されていることを確認します。
$ sudo pcs property show Cluster Properties: cluster-infrastructure: corosync cluster-name: openstackHA dc-version: 1.1.12-a14efad have-watchdog: false stonith-enabled: false
17.2. フェンシングの有効化
オーバークラウドがデプロイされて機能していることを確認した後に、フェンシングを設定することができます。
fencing.yamlファイルを生成します。$ openstack overcloud generate fencing --ipmi-lanplus --ipmi-level administrator --output fencing.yaml instackenv.json
サンプルの
fencing.yamlファイル:parameter_defaults: EnableFencing: true FencingConfig: devices: - agent: fence_ipmilan host_mac: 11:11:11:11:11:11 params: action: reboot ipaddr: 10.0.0.101 lanplus: true login: admin passwd: InsertComplexPasswordHere pcmk_host_list: host04 privlvl: administrator
以前オーバークラウドのデプロイに使用した
deployコマンドに、生成されたfencing.yamlファイルを渡します。これでデプロイメントの手順が再実行され、ホスト上でフェンシングが設定されます。openstack overcloud deploy --templates -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml -e ~/templates/network-environment.yaml -e ~/templates/storage-environment.yaml --control-scale 3 --compute-scale 3 --ceph-storage-scale 3 --control-flavor control --compute-flavor compute --ceph-storage-flavor ceph-storage --ntp-server pool.ntp.org --neutron-network-type vxlan --neutron-tunnel-types vxlan -e fencing.yaml
デプロイメントのコマンドは、エラーまたは例外なしで完了するはずです。
オーバークラウドにログインし、各コントローラーにフェンシングが設定されたことを確認します。
フェンシングリソースが Pacemaker で管理されていることを確認します。
$ source stackrc $ nova list | grep controller $ ssh heat-admin@<controller-x_ip> $ sudo pcs status |grep fence stonith-overcloud-controller-x (stonith:fence_ipmilan): Started overcloud-controller-y
Pacemaker が、
fencing.yamlで指定されている各コントローラーの STONITH リソースを使用するように設定されていることを確認します。fence-resourceプロセスは、そのプロセスが制御する同じホスト上には設定すべきではありません。pcsでフェンシングリソースの属性を確認します。$ sudo pcs stonith show <stonith-resource-controller-x>
STONITH が使用する値は、
fencing.yamlに定義されている値と一致している必要があります。
17.3. フェンシングのテスト
この手順は、フェンシングが想定通りに機能しているかどうかをテストします。
デプロイメント内の各コントローラーでフェンシングのアクションをトリガーします。
コントローラーにログインします。
$ source stackrc $ nova list |grep controller $ ssh heat-admin@<controller-x_ip>
root として、
iptablesを使用して全ポートを閉鎖することによって、フェンシングをトリガーします。$ sudo -i iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT && iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT && iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 5016 -j ACCEPT && iptables -A INPUT -p udp -m state --state NEW -m udp --dport 5016 -j ACCEPT && iptables -A INPUT ! -i lo -j REJECT --reject-with icmp-host-prohibited && iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT && iptables -A OUTPUT -p tcp --sport 5016 -j ACCEPT && iptables -A OUTPUT -p udp --sport 5016 -j ACCEPT && iptables -A OUTPUT ! -o lo -j REJECT --reject-with icmp-host-prohibited
その結果、接続が切断され、サーバーが再起動されるはずです。
別のコントローラーから、Pacemaker のログファイル内のフェンシングイベントを特定します。
$ ssh heat-admin@<controller-x_ip> $ less /var/log/cluster/corosync.log (less): /fenc*
STONITH がそのコントローラーに対して、フェンシングのアクションを発行し、Pacemaker がログ内でイベントを発生させたことが確認できるはずです。
再起動したコントローラーがクラスターに戻ったことを確認します。
-
2 番目のコントローラーから、数分待った後に
pcs statusを実行して、フェンシングされたコントローラーがクラスターに戻っているかどうかを確認します。この時間は設定によって異なります。
-
2 番目のコントローラーから、数分待った後に

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.