*Pacemaker [#s09818af]
[[Cluster Labs>+http://clusterlabs.org/]]
[[GitHub Pacemaker>+https://github.com/ClusterLabs/pacemaker]]
クラスタリング環境下で、Elastic IP Address(EIP≒Virtual IP Address)の付け替えを行ったり、
リソース管理と連携してパケット振り分けを行うミドルウェア。
Pacemakerとサーバ監視ソフト(zabbix、Nagios、etc...)を連携させる事で、
監視側でアラートが上がったらEIPの付け替えを行う事も可能。
~
*インストール [#g674171b]
&size(16){&font(b){1. ビルド・インストール};};
PacemakerはCorosyncのライブラリを使用するので、&font(b){Pacemakerのビルド前にCorosyncを入れておく。};
また、configureオプションもCorosyncと同様にした方が動作不良が起きにくい。
"make install"する時に、Pacemaker用のグループとユーザが必要になるので事前に作っておく。
 # 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* .
~
&size(16){&font(b){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
~
&size(16){&font(b){3. 設定};};
Pacemaker単体ではEIPの設定が出来ない為、EIP設定専用のshellをインストールする。
代表的な物としては、[[crm:+http://crmsh.github.io/]]と[[pcs>Linux/Command/pcs]]の二種類がある。
crmはRedhat6.4辺りからプロジェクトが独立してしまい、現在はopenSUSEのリポジトリでサポートされている。
pcsはGitHubをベースに展開されている。
~
今後はどちらが生き残るかわからないが、
-高機能と前例事例で選ぶならcrm
-今後の主流になりそうなpcs

の二つを元にshellを選べば良い。
また、crmとpcsは設定方法に互換性が&font(b){無い};ので、初期選択には注意する。