所需软件包:
cluster-glue-1.0.6-1.6.el5.i386.rpm heartbeat-libs-3.0.3-2.3.el5.i386.rpm
pacemaker-cts-1.1.5-1.1.el5.i386.rpm cluster-glue-libs-1.0.6-1.6.el5.i386.rpm
libesmtp-1.0.4-5.el5.i386.rpm pacemaker-libs-1.1.5-1.1.el5.i386.rpm
corosync-1.2.7-1.1.el5.i386.rpm openais-1.1.3-1.6.el5.i386.rpm
perl-TimeDate-1.16-5.el5.noarch.rpm corosynclib-1.2.7-1.1.el5.i386.rpm
openaislib-1.1.3-1.6.el5.i386.rpm resource-agents-1.0.4-1.1.el5.i386.rpm
heartbeat-3.0.3-2.3.el5.i386.rpm pacemaker-1.1.5-1.1.el5.i386.rpm
一:IP地址hosts文件以及主机名配置
修改主机名和hosts文件
server1:
shell>hostname server1.gz.com
shell>vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server1.gz.com
shell>vim /etc/hosts
192.168.2.10 server1.gz.com
192.168.2.20 server2.gz.com
server2:
shell>hostname server2.gz.com
shell>vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=server2.gz.com
shell>vim /etc/hosts
192.168.2.10 server1.gz.com
192.168.2.20 server2.gz.com
二:软件安装
在根目录下新建一个corosync文件夹,将软件包全部上传到此文件夹下。
shell>cd /corosync
shell>yum localinstall *rpm --nogpgcheck
三:配置corosync
shell>cd /etc/corsync
shell> cp -p corosync.conf.example corosync.conf
shell> vim corosync.conf
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 192.168.2.0
mcastaddr: 226.94.1.1
mcastport: 5405
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
to_syslog: yes
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
shell> mkdir /var/log/cluster/ #新建群集日志目录
shell> corosync-keygen
shell> service corosync start
检查错误以及查看启动过程
shell>grep -i -e "corosync cluster engine" -e "configuration file" /var/log/messages
shell>grep -i totem /var/log/messages
shell>grep -i error /var/log/messages
shell>grep -i pcmk_startup /var/log/messages
安装服务
shell>yum install httpd
定义资源服务
shell>crm
crm(live)configure# primitive webip ocf:heartbeat:IPaddr params ip=192.168.2.100
crm(live)configure# property stonith-enabled=false
crm(live)configure# group webgroup webip webserver
crm(live)configure# property no-quorum-policy=ignore
四:测试