CentOS7.1でPacemaker+corosyncによるクラスタを構成する
CentOS7.1でPacemaker+corosyncを使用したクラスタを構成してみた。RHEL/CentOS7におけるPacemaker+corosyncの日本語情報が少ないので、参考情報として記載する。
2. 検証環境構成
以下の様な構成で検証を行った。
構成のポイントは以下の通り。
4. VM初期構成手順
(1) VM作成
まずはVagrantにて、予め用意したBox(CentOS7.1)から新規VMを作成する。CentOS7.1のBox作成手順については、下記を参照のこと。
今回は新規に2台VMを作成するため、下記の様に予めフォルダを作成した。
C:\vm>dir C:\vm のディレクトリ 2015/06/04 17:24 <DIR> . 2015/06/04 17:24 <DIR> .. 2015/06/04 11:57 <DIR> basebox 2015/05/28 16:11 <DIR> centos01 2015/06/03 12:18 <DIR> centos02
新規VM用に、Vagrantfileを2つ作成し、上記のVM用フォルダ(centos01, centos02)にそれぞれ配置する。"centos01"用のVagrantfileは以下の通りとした。
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.hostname = "centos01" config.vm.box = "CentOS-7.1-x86_64-minimal-ja-20150528" config.vm.provider "virtualbox" do |vb| # vb.gui = true vb.memory = "512" vb.customize ["modifyvm", :id, "--nic2", "hostonly"] vb.customize ["modifyvm", :id, "--nictype2", "82540EM"] vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] vb.customize ["modifyvm", :id, "--cableconnected2", "on"] vb.customize ["modifyvm", :id, "--nic3", "intnet"] vb.customize ["modifyvm", :id, "--nictype3", "82540EM"] vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] vb.customize ["modifyvm", :id, "--cableconnected3", "on"] end config.vm.network "private_network", ip: "192.168.56.11" end
NATネットワーク用NICはBoxの時点で構成済みのため、上記ではHostOnlyネットワーク用の"nic2"と、内部ネットワーク用の"nic3"を追加している。追加nic設定に関する記載方法はVirtualBoxのVBoxManageコマンド仕様(Chapter 8. VBoxManage)に従う。
HostOnlyネットワーク用のIPアドレスは"private_network"で指定している。VagrantはVMにHostOnlyアダプタが存在する場合、そこに"private_network"で指定したIPアドレスを設定する。HostOnlyアダプタが存在しなければ、Vagrantが自動的に作成するが、上記ではあえて明示的に追加している。
Vagrantfileの配置が完了したら、"vagrant up"コマンドによりVMを作成する。以下に"centos01"の例を示す。
C:\vm>cd C:\vm\centos01 C:\vm\centos01>vagrant up
(2) OS設定
基本的な設定はBox作成時点で実施済みのため、ここではネットワーク周りの設定を行う。
まずIPv6は使用しないため、無効化しておく。
[root@centos01 ~]# vim /etc/sysctl.conf # System default settings live in /usr/lib/sysctl.d/00-system.conf. # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file # # For more information, see sysctl.conf(5) and sysctl.d(5). net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 [root@centos01 ~]# sysctl -p net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
次に、内部ネットワーク用NIC(enp0s9)に対してIPアドレスを設定する。確認すると、デバイスとしては認識されているが、NetworkManagerには認識されていない。network-scripts配下に設定ファイルが存在しないためである。
[root@centos01 ~]# ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:60:8c:4e brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3 valid_lft 86184sec preferred_lft 86184sec 3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:45:cc:99 brd ff:ff:ff:ff:ff:ff inet 192.168.56.11/24 brd 192.168.56.255 scope global enp0s8 valid_lft forever preferred_lft forever 4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:f0:5f:8a brd ff:ff:ff:ff:ff:ff [root@centos01 ~]# nmcli c show 名前 UUID タイプ デバイス 有線接続 1 4c5bd390-a059-43d1-a109-de3802e9e842 802-3-ethernet -- enp0s3 d28eb2ae-0fef-4869-b984-ee7eaf640499 802-3-ethernet enp0s3 [root@centos01 ~]# [root@centos01 ~]# cd /etc/sysconfig/network-scripts/ [root@centos01 network-scripts]# [root@centos01 network-scripts]# ls -l 合計 236 -rw-r--r--. 1 root root 310 5月 28 14:06 ifcfg-enp0s3 -rw-r--r-- 1 root root 217 6月 4 17:37 ifcfg-enp0s8 -rw-r--r--. 1 root root 254 1月 15 17:57 ifcfg-lo ...
そのため、内部ネットワーク用NIC(enp0s9)の設定ファイル(ifcfg-enp0s9)を新規作成し、NetworkManagerサービスを再起動する。
[root@centos01 network-scripts]# vim ifcfg-enp0s9 TYPE="Ethernet" BOOTPROTO="none" IPV4_FAILURE_FATAL="no" NAME="enp0s9" DEVICE="enp0s9" ONBOOT="yes" [root@centos01 network-scripts]# systemctl restart NetworkManager [root@centos01 network-scripts]# nmcli c show 名前 UUID タイプ デバイス enp0s3 0f338d9d-cdb7-420a-988a-21e03f6f1ae4 802-3-ethernet enp0s3 enp0s3 d28eb2ae-0fef-4869-b984-ee7eaf640499 802-3-ethernet -- enp0s9 93d13955-e9e2-a6bd-df73-12e3c747f122 802-3-ethernet enp0s9
無事NetworkManagerに内部ネットワーク用NIC(enp0s9)が認識された。(この時点では"nmcli c show"の表示がおかしい。NetworkManager管理外となっているHostOnlyネットワーク用NIC(enp0s8)がなぜかenp0s3として表示されている?)
次に、nmcliでIPアドレスを設定し、NICの再起動を行う。
[root@centos01 network-scripts]# nmcli c mod enp0s9 ipv4.method manual ipv4.addresses "172.16.0.1/24" [root@centos01 network-scripts]# nmcli c down enp0s9; nmcli c up enps0s9 Connection 'enp0s9' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1) 接続が正常にアクティベートされました (D-Bus アクティブパス: /org/freedesktop/NetworkManager/ActiveConnection/2) [root@centos01 network-scripts]# ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:60:8c:4e brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3 valid_lft 86186sec preferred_lft 86186sec 3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:45:cc:99 brd ff:ff:ff:ff:ff:ff inet 192.168.56.11/24 brd 192.168.56.255 scope global enp0s8 valid_lft forever preferred_lft forever 4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:f0:5f:8a brd ff:ff:ff:ff:ff:ff inet 172.16.0.1/24 brd 172.16.0.255 scope global enp0s9 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fef0:5f8a/64 scope link valid_lft forever preferred_lft forever
最後に、hostsを設定しておく。(corosync設定用)
[root@centos01 ~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 172.16.0.1 centos01 172.16.0.2 centos02
以上でネットワーク設定は完了。"centos02"も同様に設定しておく。
5. Pacemaker+corosync初期構成
(1) Pacemaker+corosyncインストール
yumにて必要パッケージをインストールする。"pcs"と"fence-agents-all"を指定しておくと、依存関係の解決により必要パッケージがすべてインストールされる。pcsは旧来のcrmshに代わるPacemakerクラスタ管理ツールであり、RHEL/CentOS7においてはpcsの使用が推奨されている。
[root@centos01 ~]# yum -y install pcs fence-agents-all ... 依存性を解決しました ================================================================================ Package アーキテクチャー バージョン リポジトリー 容量 ================================================================================ インストール中: fence-agents-all x86_64 4.0.11-11.el7_1 updates 8.9 k pcs x86_64 0.9.137-13.el7_1.2 updates 5.4 M 依存性関連でのインストールをします: OpenIPMI-modalias x86_64 2.0.19-11.el7 base 15 k autogen-libopts x86_64 5.18-5.el7 base 66 k bc x86_64 1.06.95-13.el7 base 115 k corosync x86_64 2.3.4-4.el7_1.1 updates 205 k corosynclib x86_64 2.3.4-4.el7_1.1 updates 119 k fence-agents-apc x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-apc-snmp x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-bladecenter x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-brocade x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-cisco-mds x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-cisco-ucs x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-common x86_64 4.0.11-11.el7_1 updates 52 k fence-agents-drac5 x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-eaton-snmp x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-eps x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-hpblade x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-ibmblade x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-ifmib x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-ilo-mp x86_64 4.0.11-11.el7_1 updates 11 k fence-agents-ilo-ssh x86_64 4.0.11-11.el7_1 updates 14 k fence-agents-ilo2 x86_64 4.0.11-11.el7_1 updates 14 k fence-agents-intelmodular x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-ipdu x86_64 4.0.11-11.el7_1 updates 13 k fence-agents-ipmilan x86_64 4.0.11-11.el7_1 updates 19 k fence-agents-kdump x86_64 4.0.11-11.el7_1 updates 22 k fence-agents-rhevm x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-rsb x86_64 4.0.11-11.el7_1 updates 12 k fence-agents-scsi x86_64 4.0.11-11.el7_1 updates 15 k fence-agents-vmware-soap x86_64 4.0.11-11.el7_1 updates 14 k fence-agents-wti x86_64 4.0.11-11.el7_1 updates 13 k fence-virt x86_64 0.3.2-1.el7 base 41 k gnutls-dane x86_64 3.3.8-12.el7 base 32 k gnutls-utils x86_64 3.3.8-12.el7 base 227 k ipmitool x86_64 1.8.13-8.el7_1 updates 367 k ldns x86_64 1.6.16-7.el7 base 473 k libevent x86_64 2.0.21-4.el7 base 214 k libqb x86_64 0.17.1-1.el7_1.2 updates 91 k libtool-ltdl x86_64 2.4.2-20.el7 base 49 k libxslt x86_64 1.1.28-5.el7 base 242 k libyaml x86_64 0.1.4-11.el7_0 base 55 k nano x86_64 2.3.1-10.el7 base 440 k net-snmp-libs x86_64 1:5.7.2-20.el7 base 745 k net-snmp-utils x86_64 1:5.7.2-20.el7 base 195 k pacemaker x86_64 1.1.12-22.el7_1.2 updates 436 k pacemaker-cli x86_64 1.1.12-22.el7_1.2 updates 240 k pacemaker-cluster-libs x86_64 1.1.12-22.el7_1.2 updates 90 k pacemaker-libs x86_64 1.1.12-22.el7_1.2 updates 514 k perl-TimeDate noarch 1:2.30-2.el7 base 52 k pexpect noarch 2.3-11.el7 base 142 k psmisc x86_64 22.20-8.el7 base 140 k python-chardet noarch 2.0.1-7.el7 base 222 k python-clufter x86_64 0.9.137-13.el7_1.2 updates 270 k python-lxml x86_64 3.2.1-4.el7 base 758 k python-requests noarch 1.1.0-8.el7 base 70 k python-six noarch 1.3.0-4.el7 base 18 k python-suds noarch 0.4.1-5.el7 base 204 k python-urllib3 noarch 1.5-8.el7 base 41 k resource-agents x86_64 3.9.5-40.el7_1.3 updates 299 k ruby x86_64 2.0.0.598-24.el7 base 67 k ruby-irb noarch 2.0.0.598-24.el7 base 88 k ruby-libs x86_64 2.0.0.598-24.el7 base 2.8 M rubygem-bigdecimal x86_64 1.2.0-24.el7 base 79 k rubygem-io-console x86_64 0.4.2-24.el7 base 50 k rubygem-json x86_64 1.7.7-24.el7 base 75 k rubygem-psych x86_64 2.0.0-24.el7 base 77 k rubygem-rdoc noarch 4.0.0-24.el7 base 318 k rubygems noarch 2.0.14-24.el7 base 212 k sbd x86_64 1.2.1-3 base 32 k sg3_utils x86_64 1.37-5.el7 base 640 k sg3_utils-libs x86_64 1.37-5.el7 base 63 k telnet x86_64 1:0.17-59.el7 base 63 k unbound-libs x86_64 1.4.20-19.el7 base 294 k トランザクションの要約 ================================================================================ インストール 2 パッケージ (+72 個の依存関係のパッケージ) ... 完了しました!
この時点でサーバを再起動する。
次に、corosyncによるサーバ間通信の認証で使用される"hacluster"ユーザのパスワードを設定する。上記のパッケージインストール時に自動的にユーザが作成されているため、パスワード変更のみ行う。パスワードはクラスタを構成するすべてのサーバにて同一とする。
[root@centos01 ~]# passwd hacluster ユーザー hacluster のパスワードを変更。 新しいパスワード: 新しいパスワードを再入力してください: passwd: すべての認証トークンが正しく更新できました。
次に、pcsdサービスを起動および有効化する。pcsdはPacemakerやcorosyncとは独立したサービスであり、これが起動していないとクラスタ構成時に使用するpcsコマンドが使えないため。
[root@centos01 ~]# systemctl start pcsd [root@centos01 ~]# systemctl enable pcsd ln -s '/usr/lib/systemd/system/pcsd.service' '/etc/systemd/system/multi-user.target.wants/pcsd.service' [root@centos01 ~]# [root@centos01 ~]# systemctl status pcsd pcsd.service - PCS GUI and remote configuration interface Loaded: loaded (/usr/lib/systemd/system/pcsd.service; enabled) Active: active (running) since 木 2015-06-04 18:10:11 JST; 15s ago Main PID: 3921 (pcsd) CGroup: /system.slice/pcsd.service tq3921 /bin/sh /usr/lib/pcsd/pcsd start tq3925 /bin/bash -c ulimit -S -c 0 >/dev/null 2>&1 ; /usr/bin/ruby... mq3926 /usr/bin/ruby -I/usr/lib/pcsd /usr/lib/pcsd/ssl.rb 6月 04 18:10:11 centos01 systemd[1]: Starting PCS GUI and remote configur..... 6月 04 18:10:11 centos01 systemd[1]: Started PCS GUI and remote configura...e. Hint: Some lines were ellipsized, use -l to show in full.
以上の手順をcentos02に対しても同様に行う。
次に、corosync設定として、"pcs cluster auth"コマンドによりノードの認証を行う。これにより、corosyncによるサーバ間通信が可能となる。
[root@centos01 ~]# pcs cluster auth centos01 centos02 -u hacluster -p <password> --force centos01: Authorized centos02: Authorized
次に、"pcs cluster setup"コマンドにより、初期クラスタの作成を行う。
[root@centos01 ~]# pcs cluster setup --name testcluster centos01 centos02 Shutting down pacemaker/corosync services... Redirecting to /bin/systemctl stop pacemaker.service Redirecting to /bin/systemctl stop corosync.service Killing any remaining services... Removing all cluster configuration files... centos01: Succeeded centos02: Succeeded
上記が成功したら、下記コマンドによりクラスタを起動する。
[root@centos01 ~]# pcs cluster start --all centos01: Starting Cluster... centos02: Starting Cluster...
(2) 初期状態確認
まず、"corosync-cfgtool -s"コマンドにより、corosyncによるサーバ間通信の状況を確認する。
[root@centos01 ~]# corosync-cfgtool -s Printing ring status. Local node ID 1 RING ID 0 id = 172.16.0.1 status = ring 0 active with no faults
"status"が"active"かつ"no faults"であれば、問題なく通信が行えている。同様に、以下のコマンドでもcorosyncの動作状況を確認できる。
[root@centos01 ~]# corosync-cpamapctl | grep members runtime.totem.pg.mrp.srp.members.1.config_version (u64) = 0 runtime.totem.pg.mrp.srp.members.1.ip (str) = r(0) ip(172.16.0.1) runtime.totem.pg.mrp.srp.members.1.join_count (u32) = 1 runtime.totem.pg.mrp.srp.members.1.status (str) = joined runtime.totem.pg.mrp.srp.members.2.config_version (u64) = 0 runtime.totem.pg.mrp.srp.members.2.ip (str) = r(0) ip(172.16.0.2) runtime.totem.pg.mrp.srp.members.2.join_count (u32) = 1 runtime.totem.pg.mrp.srp.members.2.status (str) = joined [root@centos01 ~]# pcs status corosync Membership information ---------------------- Nodeid Votes Name 1 1 centos01 (local) 2 1 centos02
次に、Pacemakerとcorosyncのプロセス群が正常に起動しているかを確認する。下記プロセスが起動していれば問題ない。
[root@centos01 ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND ... root 2258 1.5 7.5 191512 37656 ? Ssl 18:39 0:01 corosync root 2273 0.0 1.4 130424 7236 ? Ss 18:39 0:00 /usr/sbin/pacemakerd -f haclust+ 2274 0.0 2.7 132772 13788 ? Ss 18:39 0:00 /usr/libexec/pacemaker/cib root 2275 0.0 1.5 133892 8004 ? Ss 18:39 0:00 /usr/libexec/pacemaker/stonithd root 2276 0.0 0.9 102872 5008 ? Ss 18:39 0:00 /usr/libexec/pacemaker/lrmd haclust+ 2277 0.0 1.5 124700 7612 ? Ss 18:39 0:00 /usr/libexec/pacemaker/attrd haclust+ 2278 0.0 4.1 150932 20904 ? Ss 18:39 0:00 /usr/libexec/pacemaker/pengine haclust+ 2279 0.1 2.2 184088 11216 ? Ss 18:39 0:00 /usr/libexec/pacemaker/crmd ...
次に、"pcs status"コマンドでクラスタ状態を確認する。
[root@centos01 ~]# pcs status Cluster name: testcluster WARNING: no stonith devices and stonith-enabled is not false Last updated: Thu Jun 4 18:40:43 2015 Last change: Thu Jun 4 18:32:41 2015 Stack: corosync Current DC: centos01 (1) - partition with quorum Version: 1.1.12-a14efad 2 Nodes configured 0 Resources configured Online: [ centos01 centos02 ] Full list of resources: PCSD Status: centos01: Online centos02: Online Daemon Status: corosync: active/disabled pacemaker: active/disabled pcsd: active/enabled
両ノードともOnlineであり、リソースはまだ定義されていないことが確認できる。また、この時点ではstonithに関するWARNINGが表示されている。そこで、"crm_verify"コマンドで設定を確認してみる。
[root@centos01 ~]# crm_verify -L -V error: unpack_resources: Resource start-up disabled since no STONITH resources have been defined error: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option error: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity Errors found during check: config not valid
Pacemakerでは規定でstonith機能が有効となっているが、まだstonithリソースが定義されていないため、上記のエラーが表示されている。今回はstonith機能は使用しないので、無効化しておく。
[root@centos01 ~]# pcs property set stonith-enabled=false [root@centos01 ~]# crm_verify -L -V [root@centos01 ~]#
以上により、クラスタの初期状態が正常であることが確認できた。
6. リソース追加(仮想IP)
(1) リソース追加
次に、リソースとして仮想IPを追加する。リソース追加時は"pcs resource create"コマンドを使用する。リソースのパラメータは以下の通り。
- リソースID:VIP
- リソースエージェント(RA):"ocf:heartbeat:IPaddr2"
- IPアドレス:192.168.56.10/24(HostOnlyネットワークアドレス)
- 監視間隔:10sec
[root@centos01 ~]# pcs resource create VIP ocf:heartbeat:IPaddr2 \ ip=192.168.56.10 cidr_netmask=24 op monitor interval=10s
そもそもリソースとは、クラスタが提供するサービスの構成要素である。今回構成する仮想IPやapache HTTP serverがこれにあたる。リソースを定義する際は、必ずリソースエージェント(RA)の指定が必要となる。RAとは、Pacemakerがリソースを起動・停止・監視するために用いるプログラムであり、実態はシェルスクリプトになっている*1。RAのソースコードのうち、特に正常性判定条件については、どういった状況下でリソースがフェールオーバーするのかを理解する意味で、一読しておくことをおすすめする。
RAの実装は基本的にOCF(Open Cluster Framework*2)に従っている。サーバ上では、RAスクリプトは"/lib/ocf/resource.d/"配下に格納されている。
"pcs status"でクラスタの状態を確認してみる。
[root@centos01 ~]# pcs status Cluster name: testcluster Last updated: Thu Jun 4 18:59:36 2015 Last change: Thu Jun 4 18:59:21 2015 Stack: corosync Current DC: centos02 (2) - partition with quorum Version: 1.1.12-a14efad 2 Nodes configured 1 Resources configured Online: [ centos01 centos02 ] Full list of resources: VIP (ocf::heartbeat:IPaddr2): Started centos01 PCSD Status: centos01: Online centos02: Online Daemon Status: corosync: active/disabled pacemaker: active/disabled pcsd: active/enabled
リソースとして"VIP"が追加され、centos01で動作していることがわかる。"ip addr show"を実行すると、HostOnlyアダプタのセカンダリIPとして仮想IPが設定されている。
[root@centos01 ~]# ip addr show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever 2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:60:8c:4e brd ff:ff:ff:ff:ff:ff inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3 valid_lft 84670sec preferred_lft 84670sec 3: enp0s8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:45:cc:99 brd ff:ff:ff:ff:ff:ff inet 192.168.56.11/24 brd 192.168.56.255 scope global enp0s8 valid_lft forever preferred_lft forever inet 192.168.56.10/24 brd 192.168.56.255 scope global secondary enp0s8 valid_lft forever preferred_lft forever 4: enp0s9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 08:00:27:f0:5f:8a brd ff:ff:ff:ff:ff:ff inet 172.16.0.1/24 brd 172.16.0.255 scope global enp0s9 valid_lft forever preferred_lft forever
(2) リソースフェールオーバー
ここで、動作確認としてcentos01のPacemakerとcorosyncを停止し、リソースをフェールオーバーさせてみる。
[root@centos01 ~]# pcs cluster stop centos01 centos01: Stopping Cluster (pacemaker)... centos01: Stopping Cluster (corosync)... [root@centos01 ~]# pcs status Error: cluster is not currently running on this node
centos02でクラスタの状態を確認すると、仮想IPリソースがフェールオーバーしているのがわかる。
[root@centos02 ~]# pcs status Cluster name: testcluster Last updated: Thu Jun 4 19:27:55 2015 Last change: Thu Jun 4 18:59:20 2015 Stack: corosync Current DC: centos02 (2) - partition with quorum Version: 1.1.12-a14efad 2 Nodes configured 1 Resources configured Online: [ centos02 ] OFFLINE: [ centos01 ] Full list of resources: VIP (ocf::heartbeat:IPaddr2): Started centos02 PCSD Status: centos01: Online centos02: Online Daemon Status: corosync: active/disabled pacemaker: active/disabled pcsd: active/enabled