0
0

More than 3 years have passed since last update.

pacemaker下でNGINXがsystemctl stopで切り替わらない現象に遭遇しました

Posted at

CentOS 7の仮想マシン2台でHAクラスタを構成したのですが、NGINXが思うように切り替わらない現象に遭遇しました。どうやら、切り替わり条件の設定が足りなかったようです。

環境

マシンAとマシンBにそれぞれNGINXサーバを立てて、仮想IP(192.168.1.15)で外部にサービスする構成を作ってみました。

  • CentOS 7.4(1708)
    • 仮想IP : 192.168.1.15
    • マシンA(serverA): 固定192.168.1.13
    • マシンB(serverB): 固定192.168.1.14
  • pcs 0.9.158
  • pacemaker 1.1.16
  • corosync 2.4.0

HAクラスタ構築

NGINXは障害で切り替わってほしいというより、人間系(systemctl stop)で切り替わるようにしたかったので、RAはsystemdを使いました。

#はrootでの設定を表しています
# pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.1.15 cidr_netmask=24 op monitor interval=30s
# pcs resource create webserver systemd:nginx op monitor timeout="5s" interval="5s"
# pcs constraint colocation add webserver virtual_ip INFINITY
# pcs constraint order virtual_ip then webserver
# pcs property set stonith-enabled=false
# pcs property set no-quorum-policy=ignore
# pcs cluster stop --all
# pcs cluster start --all

問題発生のきっかけ

上記の環境下で以下のように現用系を止めても片側に切り替えてくれませんでした。

[root@serverA ~]# systemctl stop NGINX

問題解消

LINUX-HA JAPANメーリングリストの中で解決方法を教えていただき、設定に以下を追加しました。

#はrootでの設定を表しています
# pcs resource defaults migration-threshold=1

この設定を適用した後は期待通り切り替わるようになりました。

参考

以上

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0