# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
# wget -O /etc/yum.repos.d/pacemaker.repo http://clusterlabs.org/rpm/epel-5/clusterlabs.repo
3.安装corosync和pacemaker
# yum install -y corosync* pacemaker*
从
pacemaker1.1.8版本开始,crm sh发展成一个独立项目,pacemaker中不再提供,说明我们安装好pacemaker后,它不提供crm命令行模式的资源管理器,需要再独立安装crmsh
#
wget http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/x86_64/pssh-2.3.1-3.2.x86_64.rpm
compatibility: whitetank
totem {
version: 2 #协议版本
secauth: on #是否启用节点之间安全认证
threads: 1 #启动的线程,与cpu核心数相等,0为自动管理
interface { #定义传递心跳的接口信息
ringnumber: 0 #如果有多个接口,ringnumber不能相同
bindnetaddr: 172.16.5.0 #指定接口所在的网络地址或者接口的ip地址
mcastaddr: 226.94.1.1 #多播地址
mcastport: 5405 #多播使用端口
ttl: 1
}
}
logging { #定义日志相关信息
fileline: off
to_stderr: no #是否把错误信息发送到标准输出
to_logfile: yes #是否存储到logfile指定的日志文件
to_syslog: no #是否存储到系统日志
logfile: /var/log/cluster/corosync.log #日志文件路径
debug: off #是否打开调试信息
timestamp: on #日志信息是否记录时间戳
logger_subsys { #用于提供日志子系统
subsys: AMF
debug: off
}
}
amf { #定义amf相关信息,如果要启用amf,需要安装openais和openais-libs
mode: disabled
}
添加如下内容:
service { #自定义的服务
ver: 0 #版本
name: pacemaker #服务启动时自动启动pacemaker
use_mgmtd: yes #使用mgmtd进程
}
aisexec {
user: root
group: root
}
并设定此配置文件中bindnetaddr后面的ip地址为网卡所在网络的网络地址,这里的两个节点在172.16.5.0网络,因此这里将其设定为 172.16.5.0 ;如下:
bindnetaddr: 172.16.5.0
|
Oct 23 17:48:10 corosync [MAIN ] Corosync Cluster Engine ('1.4.1'): started and ready to provide service.
Oct 23 17:48:10 corosync [MAIN ] Successfully read main configuration file '/etc/corosync/corosync.conf'.
|
Oct 23 17:48:11 corosync [TOTEM ] Initializing transport (UDP/IP Multicast).
Oct 23 17:48:11 corosync [TOTEM ] Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0).
Oct 23 17:48:11 corosync [TOTEM ] The network interface [172.16.5.158] is now up.
Oct 23 17:48:11 corosync [TOTEM ] Process pause detected for 713 ms, flushing membership messages.
Oct 23 17:48:11 corosync [TOTEM ] A processor joined or left the membership and a new membership was formed.
|
Oct 23 17:48:11 corosync [pcmk ] info: pcmk_startup: CRM: Initialized
Oct 23 17:48:11 corosync [pcmk ] Logging: Initialized pcmk_startup
Oct 23 17:48:11 corosync [pcmk ] info: pcmk_startup: Maximum core file size is: 18446744073709551615
Oct 23 17:48:11 corosync [pcmk ] info: pcmk_startup: Service: 9
Oct 23 17:48:11 corosync [pcmk ] info: pcmk_startup: Local hostname: hadoopm.cmmobi-wh.com
|
Oct 23 17:48:11 corosync [pcmk ] ERROR: process_ais_conf: You have configured a cluster using the Pacemaker plugin for Corosync. The plugin is not supported in this environment and will be removed very soon.
Oct 23 17:48:11 corosync [pcmk ] ERROR: process_ais_conf: Please see Chapter 8 of 'Clusters from Scratch' (http://www.clusterlabs.org/doc) for details on using Pacemaker with CMAN
|
Last updated: Wed Oct 23 18:18:22 2013
Last change: Wed Oct 23 17:48:26 2013 via crmd on test.cmmobi-wh.com
Stack: classic openais (with plugin)
Current DC: test.cmmobi-wh.com - partition with quorum
Version: 1.1.8-7.el6-394e906
2 Nodes configured, 2 expected votes
0 Resources configured.
Online: [ hadoopm.cmmobi-wh.com test.cmmobi-wh.com ]
|
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
-V may provide more details
|
node hadoopm.cmmobi-wh.com
node test.cmmobi-wh.com
property $id="cib-bootstrap-options" \
dc-version="1.1.8-7.el6-394e906" \
cluster-infrastructure="classic openais (with plugin)" \
expected-quorum-votes="2" \
stonith-enabled="false"
|
lsb
ocf / heartbeat pacemaker redhat
service
stonith
|
Failed actions:
WebIP_start_0 (node=test.cmmobi-wh.com, call=14, rc=1, status=complete): unknown error
WebIP_start_0 (node=hadoopm.cmmobi-wh.com, call=14, rc=1, status=complete): unknown error
|
Last updated: Fri Oct 25 11:58:55 2013
Last change: Fri Oct 25 11:49:12 2013 via cibadmin on hadoopm.cmmobi-wh.com
Stack: classic openais (with plugin)
Current DC: test.cmmobi-wh.com - partition with quorum
Version: 1.1.8-7.el6-394e906
2 Nodes configured, 2 expected votes
1 Resources configured.
Online: [ hadoopm.cmmobi-wh.com test.cmmobi-wh.com ]
WebIP(ocf::heartbeat:IPaddr):Started hadoopm.cmmobi-wh.com
|
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:50:56:9c:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.16.5.158/24 brd 172.16.5.255 scope global eth0
inet 172.16.5.187/24 brd 172.16.5.255 scope global secondary eth0:0
inet6 fe80::250:56ff:fe9c:2/64 scope link
valid_lft forever preferred_lft forever
|
Last updated: Fri Oct 25 19:08:37 2013
Last change: Fri Oct 25 19:05:56 2013 via crm_attribute on hadoopm.cmmobi-wh.com
Stack: classic openais (with plugin)
Current DC: test.cmmobi-wh.com - partition WITHOUT quorum
Version: 1.1.8-7.el6-394e906
2 Nodes configured, 2 expected votes
1 Resources configured.
Online: [ test.cmmobi-wh.com ]
OFFLINE: [ hadoopm.cmmobi-wh.com ]
|
Last updated: Fri Oct 25 19:16:31 2013
Last change: Fri Oct 25 19:16:10 2013 via cibadmin on test.cmmobi-wh.com
Stack: classic openais (with plugin)
Current DC: test.cmmobi-wh.com - partition WITHOUT quorum
Version: 1.1.8-7.el6-394e906
2 Nodes configured, 2 expected votes
1 Resources configured.
Online: [ test.cmmobi-wh.com ]
OFFLINE: [ hadoopm.cmmobi-wh.com ]
WebIP(ocf::heartbeat:IPaddr):Started test.cmmobi-wh.com
|