您的位置:首页 > 运维架构 > Linux

Linux 高可用(HA)集群之heartbeat基于crm进行资源管理详解

2013-08-21 00:00 746 查看

大纲
一、环境准备
二、拓扑准备
三、前提条件
四、安装相关软件
五、配置 heartbeat(crm 资源管理器)
六、crm资源管理器
七、crm图形界面配置详解
八、高可用集群架构回顾
九、crm配置资源
十、crm资源约束
十一、crm资源配置总结

相关系列文章

Corosync+Pacemaker+DRBD+MySQL 实现高可用(HA)的MySQL集群 http://www.linuxidc.com/Linux/2013-08/89036.htm

Linux 高可用(HA)集群之DRBD详解 http://www.linuxidc.com/Linux/2013-08/89035.htm

Linux 高可用(HA)集群之Pacemaker详解 https://www.geek-share.com/detail/2587755249.html

Linux 高可用(HA)集群之Corosync详解 http://www.linuxidc.com/Linux/2013-08/88733.htm

Heartbeat+MySQL+NFS 实现高可用(HA)的MySQL集群 http://www.linuxidc.com/Linux/2013-08/88663.htm

Linux 高可用(HA)集群之heartbeat基于crm进行资源管理详解 http://www.linuxidc.com/Linux/2013-08/89167.htm

Heartbeat+httpd+NFS 实现高可用的Web服务器 http://www.linuxidc.com/Linux/2013-08/88520.htm

Linux 高可用(HA)集群之Heartbeat详解 http://www.linuxidc.com/Linux/2013-08/88521.htm

Linux 高可用(HA)集群基本概念详解 http://www.linuxidc.com/Linux/2013-08/88522.htm

一、环境准备
1.操作系统
CentOS 5.5 X86_64 最小化安装
说明:一般Heartbeat v2.x 都安装在CentOS 5.x系列中,而CentOS 6.x中都用Heartbeat v3.x。
2.相关软件(软件下载)
Heartbeat 2.1.4

Heartbeat-gui 2.1.4

Apache 2.2.3

Xmanager Enterprise 4

3.配置epel YUM源(两节点都要配置)
node1,node2:
[root@node src]# wget http://download.Fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
[root@node src]# rpm -ivh epel-release-5-4.noarch.rpm
warning: epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
1:epel-release          ########################################### [100%]
[root@node src]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[root@node src]# yum list

4.关闭防火墙与SELinux (两节点都要配置)
node1,node2:
[root@node ~]# service iptables stop
[root@node ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#      enforcing - SELinux security policy is enforced.
#      permissive - SELinux prints warnings instead of enforcing.
#      disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#      targeted - Only targeted network daemons are protected.
#      strict - Full SELinux protection.
SELINUXTYPE=targeted

二、拓扑准备

说明:有两个节点分别为node1与node2,VIP为192.168.1.200,测试机是一台Windows7主机,NFS服务器为192.168.1.208
三、前提条件
1.节点之间主机名互相解析
node1,node2:
[root@node ~]# vim /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1              localhost.localdomain localhost
::1            localhost6.localdomain6 localhost6
192.168.1.201  node1.test.com  node1
192.168.1.202  node2.test.com  node2

2.节点之间时间得同步
node1,node2:
[root@node ~]# yum -y install ntp
[root@node ~]# ntp 210.72.145.44
[root@node ~]# date
2013年 08月 07日 星期三 16:06:30 CST

3.节点之间配置SSH互信
node1:
[root@node1 ~]# ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P ''
[root@node1 ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node2.test.com
[root@node1 ~]# ssh node2
[root@node2 ~]# ifconfig     
eth0      Link encap:Ethernet  HWaddr 00:0C:29:EA:CE:79 
          inet addr:192.168.1.202  Bcast:192.168.1.255  Mask:255.255.255.0     
          inet6 addr: fe80::20c:29ff:feea:ce79/64 Scope:Link     
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1     
          RX packets:2591 errors:0 dropped:0 overruns:0 frame:0     
          TX packets:1931 errors:0 dropped:0 overruns:0 carrier:0     
          collisions:0 txqueuelen:1000     
          RX bytes:556754 (543.7 KiB)  TX bytes:465692 (454.7 KiB)
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0     
          inet6 addr: ::1/128 Scope:Host     
          UP LOOPBACK RUNNING  MTU:16436  Metric:1     
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0     
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0     
          collisions:0 txqueuelen:0     
          RX bytes:560 (560.0 b)  TX bytes:560 (560.0 b)

node2:
[root@node2 ~]# ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P ''
[root@node2 ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node1.test.com
[root@node2 ~]# ssh node1
[root@node1 ~]# ifconfig     
eth0      Link encap:Ethernet  HWaddr 00:0C:29:23:76:4D 
          inet addr:192.168.1.201  Bcast:192.168.1.255  Mask:255.255.255.0     
          inet6 addr: fe80::20c:29ff:fe23:764d/64 Scope:Link     
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1     
          RX packets:4603 errors:0 dropped:0 overruns:0 frame:0     
          TX packets:3914 errors:0 dropped:0 overruns:0 carrier:0     
          collisions:0 txqueuelen:1000     
          RX bytes:771007 (752.9 KiB)  TX bytes:728391 (711.3 KiB)
lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0     
          inet6 addr: ::1/128 Scope:Host     
          UP LOOPBACK RUNNING  MTU:16436  Metric:1     
          RX packets:32 errors:0 dropped:0 overruns:0 frame:0     
          TX packets:32 errors:0 dropped:0 overruns:0 carrier:0     
          collisions:0 txqueuelen:0     
          RX bytes:2672 (2.6 KiB)  TX bytes:2672 (2.6 KiB)

四、安装相关软件
1、客户端软件(Windows 7测试机)
重点说明:安装Xmanager Enterprise 4,如下图

注:得安装Xmanager Enterprise 4 所有套件,而不是只安装xshell软件。不然后面的crm图形界面无法打开的,切记!
2.安装heartbeat
heartbeat 安装组件说明
heartbeat 核心组件  *   

heartbeat-devel 开发包   

heartbeat-gui 图形管理接口 *    (这个必须安装,这篇博文重点讲解图形资源管理器)

heartbeat-ldirectord 为lvs高可用提供规则自动生成及后端realserver健康状态检查的组件   

heartbeat-pils 装载库插件接口 *   

heartbeat-stonith 爆头接口 *

node1,node2:
[root@node ~]# yum -y install heartbeat*

3.安装httpd (在这篇博文中我们还介绍Web的高可用,因为比较简单容易理解,下面的博文中我们会讲解mysql高可用)
node1:
[root@node1~]# yum install -y httpd
[root@node1 ~]# service httpd start
启动 httpd:                                              [确定]
[root@node1 ~]# echo "<h1>node1.test.com</h1>" > /var/www/html/index.html

测试

[root@node1 ha.d]# service httpd stop
停止 httpd:                                              [确定]
[root@node1 ha.d]# chkconfig httpd off
[root@node1 ha.d]# chkconfig httpd --list
httpd          0:关闭  1:关闭  2:关闭  3:关闭  4:关闭  5:关闭  6:关闭

说明:测试完成后关闭服务,并让其开机不启动(注,httpd由heartbeat管理)
node2:
[root@node2~]# yum install -y httpd
[root@node2 ~]# service httpd start
启动 httpd:                                              [确定]
[root@node2 ~]# echo "<h1>node2.test.com</h1>" > /var/www/html/index.html

测试

[root@node2 ha.d]# service httpd stop
停止 httpd:                                              [确定]
[root@node2 ha.d]# chkconfig httpd off
[root@node2 ha.d]# chkconfig httpd --list
httpd          0:关闭  1:关闭  2:关闭  3:关闭  4:关��  5:关闭  6:关闭

说明:测试完成后关闭服务,并让其开机不启动(注,httpd由heartbeat管理)

接下来请看第2页精彩内容: http://www.linuxidc.com/Linux/2013-08/89167p2.htm

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  heartbeat HA集群