LoginSignup
8
9

More than 5 years have passed since last update.

古い記事: Pacemaker + Heartbeatで仮想IPアドレス (CentOS6)

Last updated at Posted at 2014-08-05

新しい記事

その他

参考

環境

  • CentOS6.5
  • パッケージ Linux-HA Japan配布分を使う。
    • heartbeat-3.0.5-1.1
    • pacemaker-1.0.13-1
    • 2014-08-13にバージョンアップあり
  • サーバ
    • drbd01(192.168.100.199)
    • drbd02(192.168.100.200)

pacemakerとheartbeatインストール

Linux-HA Japanからpacemaker-1.0.13-1.2.el6.x86_64.repo.tar.gz/tmpに展開。

cd /tmp/pacemaker-1.0.13-1.2.el6.x86_64.repo/
yum -c pacemaker.repo install \
  pacemaker-1.0.13 heartbeat pm_extras pm_diskd pm_logconv-hb

設定

cp /usr/share/doc/heartbeat-3.0.5/authkeys /etc/ha.d/
cp /usr/share/doc/heartbeat-3.0.5/ha.cf /etc/ha.d/

/etc/ha.d/authkeys

/etc/ha.d/authkeys
- #auth 1
- #1 crc
+ auth 1
+ 1 crc
chmod 600 /etc/ha.d/authkeys

/etc/ha.d/ha.cf

  • 追記
/etc/ha.d/ha.cf
pacemaker       on
logfacility     local1
keepalive       2
udpport         694
ucast           eth0 192.168.100.199
ucast           eth0 192.168.100.200
node            drbd01
node            drbd02
respawn root /usr/lib64/heartbeat/ifcheckd

rsyslogの設定

/etc/rsyslog.conf
- *.info;mail.none;authpriv.none;cron.none                /var/log/messages
+ *.info;mail.none;authpriv.none;cron.none;local1.none    /var/log/messages
+ local1.info       /var/log/ha-log
service rsyslog restart

heartbeat起動

# /etc/init.d/heartbeat start
Starting High-Availability services: Done.

状態確認

# crm_mon -A
============
Last updated: Tue Aug  5 11:18:32 2014
Stack: Heartbeat
Current DC: drbd02 (50423879-219d-4961-93da-a7dfe59ab2cc) - partition with quorum
Version: 1.0.13-30bb726
2 Nodes configured, unknown expected votes
0 Resources configured.
============

Online: [ drbd01 drbd02 ]


Node Attributes:
* Node drbd01:
    + drbd02-eth0                       : up
* Node drbd02:
    + drbd01-eth0                       : up

crm設定

  • crmの設定は /var/lib/heartbeat/crm/cib.xmlに保存される。
クラスタ設定
crm configure property no-quorum-policy="ignore" stonith-enabled="false"
crm configure rsc_defaults resource-stickiness="INFINITY" migration-threshold="1"
vip設定
crm configure primitive vip ocf:heartbeat:IPaddr2 \
  params ip="192.168.100.198" nic="eth0" cidr_netmask="24" \
  op monitor interval="10s"
vip確認
# ip -f inet addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 192.168.100.200/24 brd 192.168.100.255 scope global eth0
    inet 192.168.100.198/24 brd 192.168.100.255 scope global secondary eth0

drbd02に192.168.100.198が割り振られた。
drbd02を再起動させてdrbd01にIPが割り振られることを確認。

トラブルシューティング

  • CentOS6のpacemakerとepelのheartbeatをインストールした場合、service heartbeat startを実行すると以下エラーが発生する。
    • そのため、Linux-HA Japanが配布しているパッケージを利用することになりました。

ERROR: Client child command 〜 is not executable

参考: Pacemaker 構築Tips - Knowlege Database

# service heartbeat start
Starting High-Availability services:  Heartbeat failure [rc=6]. Failed.

heartbeat[1334]: 2014/08/05_10:35:55 info: Pacemaker support: on
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Client child command [/usr/lib64/heartbeat/cib] is not executable
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Directive failfast  hacluster /usr/lib64/heartbeat/cib failed
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Client child command [/usr/lib64/heartbeat/stonithd] is not executable
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Directive respawn root /usr/lib64/heartbeat/stonithd failed
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Client child command [/usr/lib64/heartbeat/attrd] is not executable
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Directive respawn  hacluster /usr/lib64/heartbeat/attrd failed
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Client child command [/usr/lib64/heartbeat/crmd] is not executable
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Directive failfast  hacluster /usr/lib64/heartbeat/crmd failed
heartbeat: udpport setting must precede media statementsheartbeat[1334]: 2014/08/05_10:35:55 ERROR: Heartbeat not started: configuration error.
heartbeat[1334]: 2014/08/05_10:35:55 ERROR: Configuration error, heartbeat not started.

# ls /usr/lib64/heartbeat/cib
ls: cannot access /usr/lib64/heartbeat/cib: そのようなファイルやディレクトリはありません
pacemaker-1.1を削除
# rpm -qa | grep pacemaker
pacemaker-libs-1.1.10-14.el6_5.3.x86_64
pacemaker-cli-1.1.10-14.el6_5.3.x86_64
pacemaker-1.1.10-14.el6_5.3.x86_64
pacemaker-cluster-libs-1.1.10-14.el6_5.3.x86_64
# rpm -e $(rpm -qa | grep pacemaker)
Pacemaker Cluster Manager is already stopped[  OK  ]
heartbeatも削除
# rpm -e $(rpm -qa | grep heartbeat)

crmの設定を一からやり直したい場合

service heartbeat stop
rm -f /var/lib/heartbeat/crm/cib*
service heartbeat start
  • 1分ほど待つとcib.xmlが生成される。

cib.xmlから復旧

cib.xmlから復旧
cibadmin -U -x cib.xml
crm_mon -A
8
9
0

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
8
9