Cluster Labs
GitHub Pacemaker
クラスタリング環境下で、Elastic IP Address(EIP≒Virtual IP Address)の付け替えを行ったり、
リソース管理と連携してパケット振り分けを行うミドルウェア。
Pacemakerとサーバ監視ソフト(zabbix、Nagios、etc...)を連携させる事で、
監視側でアラートが上がったらEIPの付け替えを行う事も可能。
1. ビルド・インストール
PacemakerはCorosyncのライブラリを使用するので、Pacemakerのビルド前にCorosyncを入れておく。
また、configureオプションもCorosyncと同様にした方が動作不良が起きにくい。
"make install"する時に、Pacemaker用のグループとユーザが必要になるので事前に作っておく。
ビルド時にはsysconfdirとlocalstatedirをCorosyncのオプションと合わせる必要がある。
# groupadd haclient # useradd -g haclient -s /sbin/nologin -M -d /var/pacemaker hacluster # git clone git://github.com/ClusterLabs/pacemaker.git pacemaker # cd pacemaker # ./autogen.sh # ./configure --prefix=/usr/local/pacemaker --sysconfdir=/etc --localstatedir=/var # make # make install
# cd /usr/sbin # ln -s /usr/local/pacemaker/sbin/* . # cd /usr/include # ln -s /usr/local/pacemaker/include/pacemaker . # cd /usr/libexec # ln -s /usr/local/pacemaker/libexec/pacemaker . # cd /usr/lib64/pkgconfig # ln -s /usr/local/pacemaker/lib/pkgconfig/* . # cd /usr/lib64 # ln -s /usr/local/pacemaker/lib/lib* .
2. 起動
起動は、[Corosync→Pacemaker]の順番に行う。
Pacemakerが先に起動していたらPacemakerを一度停止した後、
Corosyncをreloadし、Pacemakerを再起動させる。
# /etc/init.d/pacemaker stop # /etc/init.d/corosync reload # /etc/init.d/pacemaker start
起動とクラスタノードのチェックするには、Pacemakerのコマンド(crm_mon)を使用する。
ただし、1台のみでcrm_monを打ってもノードが無い為に"0 Node"で表示される事がある点に注意。
# crm_mon Defaulting to one-shot mode You need to have curses available at compile time to enable console mode Last updated: Sun Dec 7 00:45:16 2014 Last change: Sat Dec 7 00:42:34 2014 Current DC: NONE 0 Nodes configured 0 Resources configured
3. 設定
Pacemaker単体ではEIPの設定が出来ない為、EIP設定専用のshellをインストールする。
代表的な物としては、crmとpcsの二種類がある。
crmはRedhat6.4辺りからプロジェクトが独立してしまい、現在はopenSUSEのリポジトリでサポートされている。
pcsはGitHubをベースに展開されている。
今後はどちらが生き残るかわからないが、選択の基準は以下の通りとなる。