cp /etc/corosync/corosync.example.conf /etc/corosync/corosync.conf
vim /etc/corosync/corosync.conf
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 192.168.1.0
mcastaddr: 226.94.1.1
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
to_syslog: yes
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
}
}
amf {
mode: disabled
}
s
宣告使用的资源管理名称:
cd /etc/corosync/service.d/
vim service
service {
name: pacemaker
ver: 1
}
三.把配置文件传给node2,启动服务即
[iyunv@node1 ~]# scp /etc/corosync/corosync.conf node2:/etc/corosync/
[iyunv@node1 ~]# scp /etc/corosync/service.d/service node2:/etc/corosync/service.d/
[iyunv@node1 ~]# service corosync start
[iyunv@node1 ~]# service pacemaker start
node2:
[iyunv@node2 ~]# service corosync start
[iyunv@node2 ~]# service pacemaker start
四.查看当前状态以及资源
crm_mon -1
============
Last updated: Sat May 11 10:56:55 2013
Last change: Sat May 11 10:55:57 2013 via crmd on node1
Stack: openais
Current DC: node1 - partition with quorum
Version: 1.1.7-6.el6-148fccfd5985c5590cc601123c6c16e966b85d14
2 Nodes configured, 2 expected votes
0 Resources configured.
============
Online: [ node1 node2 ]
如上所示,在线为node1,node2.下面介绍一些常用crm命令。
crm resource status 查看资源状态
crm node standby 离线
crm node online 在线
资源代理为 lsb,ocf,可以使用如下命令查看:
crm ra classes
crm ra list ocf heartbeat 查看heartbeat
crm ra list ocf redhat
五.检查一下集群是否有错,并且配置VIP地址。
crm_verify -L
由于没有爆头设备:
crm configure show
crm resource status vip
resource vip is running on: node1
如图所示,vip运行在node1上
六.配置http服务。
vim /etc/httpd/conf/httpd.conf
/Location
把LOCATION开启
并把下面改成127.0.0.1如下所示:
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
scp /etc/httpd/conf/httpd.conf node2:/etc/httpd/conf
使用crm创建web资源