使用corosync+pacemaker来实现openstack HA,本文主要介绍了corosync和pacemaker的安装和配置。
0.pacemaker资源介绍
Pacemaker 的资源主要有两类,即 LSB 和 OCF。
其中 LSB 即 Linux 标准服务,通常就是 /etc/init.d 目录下那些脚本。Pacemaker 可以用这些脚本来启停服务。在 crm ra list lsb 中可以看到。
另一类 OCF 实际上是对 LSB 服务的扩展,增加了一些高可用集群管理的功能如故障监控等和更多的元信息。可以通过 crm ra list ocf 看到当前支持的资源。
要让 pacemaker 可以很好的对服务进行高可用保障就得实现一个 OCF 资源。Pacemaker 自带的资源管理程序都在 /usr/lib/ocf/resource.d 下。
环境准备工作
1)各节点之间主机名相互解析
vim /etc/hosts
192.168.100.2 control.nsp.com control
192.168.100.3 compute1.nsp.com compute1
192.168.100.34 compute2.nsp.com compute2
2)各节点之间ssh互信
3)各节点直接ntp时间同步
①在一个节点上面搭建ntp server
在/etc/ntp.conf文件中加入如下行,然后启动ntpd
disable monitor
server 127.127.1.0
fudge 127.127.1.0 stratum 8
②在其他节点上面执行
ntpdate 192.168.100.2
1.安装corosync
yum install corosync
yum install pacemaker
2.安装crmsh(这个是crm命令之所以能够执行的关键)
rpm -ivh crmsh-2.1+git98-1.1.mira1.es.x86_64.rpm pssh-2.3.1-15.2.x86_64.rpm
3.配置corosync
1)生成秘钥
[root@node1corosync]#corosync-keygen #文件保存于/etc/corosync/authkey
这时,我们将秘钥文件拷贝到node2节点中
2)配置见后面“corosync参考配置”
4.启动corocsync和pacemaker,注意是分别启动,现在用的corosync版本启动时不能把pacemaker拉起来
systemctl start coro