测试配置:

[root@centos6-1 ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@centos6-1 ~]# uname -r
2.6.32-504.el6.x86_64

[root@centos6-1 ~]# uname -a
Linux centos6-1 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

测试机A:

[root@centos6-1 ~]# ifconfig |egrep 'eth|addr:10'
eth0      Link encap:Ethernet  HWaddr 00:0C:29:D1:B0:4C 
          inet addr:10.0.0.16  Bcast:10.0.0.255  Mask:255.255.255.0
eth1      Link encap:Ethernet  HWaddr 00:0C:29:D1:B0:56 
          inet addr:10.0.1.16  Bcast:10.0.1.255  Mask:255.255.255.0

[root@centos6-1 ~]# echo 10.0.0.16 centos6-1 >> /etc/hosts

[root@centos6-1 ~]# echo 10.0.0.26 centos6-2 >> /etc/hosts

测试机B:

[root@centos6-2 ~]#  ifconfig |egrep 'eth|addr:10'
eth0      Link encap:Ethernet  HWaddr 00:0C:29:A7:54:29 
          inet addr:10.0.0.26  Bcast:10.0.0.255  Mask:255.255.255.0
eth1      Link encap:Ethernet  HWaddr 00:0C:29:A7:54:33 
          inet addr:10.0.1.26  Bcast:10.0.1.255  Mask:255.255.255.0

[root@centos6-1 ~]# echo 10.0.0.16 centos6-1 >> /etc/hosts

[root@centos6-1 ~]# echo 10.0.0.26 centos6-2 >> /etc/hosts

互ping测试:

[root@centos6-1 ~]# ping centos6-2
PING centos6-2 (10.0.0.26) 56(84) bytes of data.
64 bytes from centos6-2 (10.0.0.26): icmp_seq=1 ttl=64 time=0.282 ms
64 bytes from centos6-2 (10.0.0.26): icmp_seq=2 ttl=64 time=0.440 ms
64 bytes from centos6-2 (10.0.0.26): icmp_seq=3 ttl=64 time=0.365 ms

[root@centos6-2 ~]# ping centos6-1
PING centos6-1 (10.0.0.16) 56(84) bytes of data.
64 bytes from centos6-1 (10.0.0.16): icmp_seq=1 ttl=64 time=0.318 ms

配置心跳线直连

添加主机路由

root@centos6-1 ~]# /sbin/route add -host 10.0.0.26 dev eth1

[root@centos6-2 ~]# /sbin/route add -host 10.0.0.16 dev eth1

添加开机启动

[root@centos6-1 ~]# echo '/sbin/route add -host 10.0.0.26 dev eth1' >> /etc/rc.local

[root@centos6-2 ~]# echo '/sbin/route add -host 10.0.0.16 dev eth1' >> /etc/rc.local

下载并安装 epel包

[root@centos6-2 tools]# wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
--2015-07-17 21:47:01--  http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Resolving mirrors.ustc.edu.cn... 202.141.160.110, 2001:da8:d800:95::110
Connecting to mirrors.ustc.edu.cn|202.141.160.110|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-redhat-package-manager]
Saving to: “epel-release-6-8.noarch.rpm”

100%[========================================================================>] 14,540      87.7K/s   in 0.2s

2015-07-17 21:47:02 (87.7 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540]

[root@centos6-2 tools]# ls
epel-release-6-8.noarch.rpm
[root@centos6-2 tools]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

yum安装HeartBeat
[root@centos6-2 tools]# yum install heartbeat*
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
epel/metalink                                                                              | 3.5 kB     00:00    
* base: mirror.bit.edu.cn
* epel: mirror.premi.st
* extras: mirror.bit.edu.cn
* updates: mirror.neu.edu.cn
epel                                                                                       | 4.4 kB     00:00    
epel/primary_db                                                                            | 6.7 MB     00:48    
Resolving Dependencies
--> Running transaction check
---> Package heartbeat.x86_64 0:3.0.4-2.el6 will be installed
--> Processing Dependency: resource-agents for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: cluster-glue-libs for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: cluster-glue for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: PyXML for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: libplumb.so.2()(64bit) for package: heartbeat-3.0.4-2.el6.x86_64
---> Package heartbeat-devel.x86_64 0:3.0.4-2.el6 will be installed
---> Package heartbeat-libs.x86_64 0:3.0.4-2.el6 will be installed
--> Running transaction check
---> Package PyXML.x86_64 0:0.8.4-19.el6 will be installed
---> Package cluster-glue.x86_64 0:1.0.5-6.el6 will be installed
--> Processing Dependency: perl-TimeDate for package: cluster-glue-1.0.5-6.el6.x86_64
---> Package cluster-glue-libs.x86_64 0:1.0.5-6.el6 will be installed
---> Package resource-agents.x86_64 0:3.9.5-12.el6_6.7 will be installed
--> Running transaction check
---> Package perl-TimeDate.noarch 1:1.16-13.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================
Package                         Arch                 Version                         Repository             Size
==================================================================================================================
Installing:
heartbeat                       x86_64               3.0.4-2.el6                     epel                  161 k
heartbeat-devel                 x86_64               3.0.4-2.el6                     epel                  123 k
heartbeat-libs                  x86_64               3.0.4-2.el6                     epel                  263 k
Installing for dependencies:
PyXML                           x86_64               0.8.4-19.el6                    base                  892 k
cluster-glue                    x86_64               1.0.5-6.el6                     base                   71 k
cluster-glue-libs               x86_64               1.0.5-6.el6                     base                  116 k
perl-TimeDate                   noarch               1:1.16-13.el6                   base                   37 k
resource-agents                 x86_64               3.9.5-12.el6_6.7                updates               357 k

Transaction Summary
==================================================================================================================
Install       8 Package(s)

Total download size: 2.0 M
Installed size: 6.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): PyXML-0.8.4-19.el6.x86_64.rpm                                                       | 892 kB     00:12    
(2/8): cluster-glue-1.0.5-6.el6.x86_64.rpm                                                 |  71 kB     00:01    
(3/8): cluster-glue-libs-1.0.5-6.el6.x86_64.rpm                                            | 116 kB     00:00    
(4/8): heartbeat-3.0.4-2.el6.x86_64.rpm                                                    | 161 kB     00:00    
(5/8): heartbeat-devel-3.0.4-2.el6.x86_64.rpm                                              | 123 kB     00:00    
(6/8): heartbeat-libs-3.0.4-2.el6.x86_64.rpm                                               | 263 kB     00:00    
(7/8): perl-TimeDate-1.16-13.el6.noarch.rpm                                                |  37 kB     00:00    
(8/8): resource-agents-3.9.5-12.el6_6.7.x86_64.rpm                                         | 357 kB     00:00    
------------------------------------------------------------------------------------------------------------------
Total                                                                             104 kB/s | 2.0 MB     00:19    
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-8.noarch (installed)
From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : cluster-glue-libs-1.0.5-6.el6.x86_64                                                           1/8
  Installing : 1:perl-TimeDate-1.16-13.el6.noarch                                                             2/8
  Installing : cluster-glue-1.0.5-6.el6.x86_64                                                                3/8
  Installing : PyXML-0.8.4-19.el6.x86_64                                                                      4/8
  Installing : resource-agents-3.9.5-12.el6_6.7.x86_64                                                        5/8
  Installing : heartbeat-libs-3.0.4-2.el6.x86_64                                                              6/8
  Installing : heartbeat-3.0.4-2.el6.x86_64                                                                   7/8
  Installing : heartbeat-devel-3.0.4-2.el6.x86_64                                                             8/8
  Verifying  : cluster-glue-libs-1.0.5-6.el6.x86_64                                                           1/8
  Verifying  : resource-agents-3.9.5-12.el6_6.7.x86_64                                                        2/8
  Verifying  : PyXML-0.8.4-19.el6.x86_64                                                                      3/8
  Verifying  : heartbeat-libs-3.0.4-2.el6.x86_64                                                              4/8
  Verifying  : heartbeat-devel-3.0.4-2.el6.x86_64                                                             5/8
  Verifying  : heartbeat-3.0.4-2.el6.x86_64                                                                   6/8
  Verifying  : cluster-glue-1.0.5-6.el6.x86_64                                                                7/8
  Verifying  : 1:perl-TimeDate-1.16-13.el6.noarch                                                             8/8

Installed:
  heartbeat.x86_64 0:3.0.4-2.el6    heartbeat-devel.x86_64 0:3.0.4-2.el6    heartbeat-libs.x86_64 0:3.0.4-2.el6

Dependency Installed:
  PyXML.x86_64 0:0.8.4-19.el6                                 cluster-glue.x86_64 0:1.0.5-6.el6                  
  cluster-glue-libs.x86_64 0:1.0.5-6.el6                      perl-TimeDate.noarch 1:1.16-13.el6                 
  resource-agents.x86_64 0:3.9.5-12.el6_6.7

Complete!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@centos6-2 ~]# yum search heartbeat
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* epel: mirror.premi.st
* extras: mirror.bit.edu.cn
* updates: mirror.neu.edu.cn
epel/pkgtags                                                                               | 1.6 MB     00:39    
============================================= N/S Matched: heartbeat =============================================
heartbeat-devel.i686 : Heartbeat development package
heartbeat-devel.x86_64 : Heartbeat development package
heartbeat-libs.i686 : Heartbeat libraries
heartbeat-libs.x86_64 : Heartbeat libraries
heartbeat.x86_64 : Messaging and membership subsystem for High-Availability Linux
pacemaker.x86_64 : Scalable High-Availability cluster resource manager
resource-agents.x86_64 : Open Source HA Reusable Cluster Resource Scripts

Name and summary matches only, use "search all" for everything.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

HeartBeat 模板配置文件

[root@centos6-2 ~]# ll /usr/share/doc/heartbeat-3.0.4/
total 144
-rw-r--r--. 1 root root  1873 Dec  3  2013 apphbd.cf
-rw-r--r--. 1 root root   645 Dec  3  2013 authkeys
-rw-r--r--. 1 root root  3701 Dec  3  2013 AUTHORS
-rw-r--r--. 1 root root 58752 Dec  3  2013 ChangeLog
-rw-r--r--. 1 root root 17989 Dec  3  2013 COPYING
-rw-r--r--. 1 root root 26532 Dec  3  2013 COPYING.LGPL

-rw-r--r--. 1 root root 10502 Dec  3  2013 ha.cf
-rw-r--r--. 1 root root  5905 Dec  3  2013 haresources
-rw-r--r--. 1 root root  2935 Dec  3  2013 README

copy 配置文件到、etc/ha.d

[root@centos6-1 heartbeat-3.0.4]# cp ha.cf haresources authkeys /etc/ha.d/

  1. heartbeat 配置文件:(主节点备节点配置相同)
    [root@heartbeat1 ha.d]# grep -v ^# /etc/ha.d/authkeys
    auth 3
    3 md5 Hello!
    [root@centos6-1 ha.d]# grep -v ^# /etc/ha.d/ha.cf

keepalive 2
deadtime 5
warntime 10
initdead 60
udpport 694
mcast eth1 225.0.0.1 694 1 0
auto_failback on
node heartbeat1

debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 5
warntime 10
initdead 60
udpport 694
mcast eth1 225.0.0.1 694 1 0
auto_failback on
node heartbeat1
node heartbeat2
[root@centos6-1 ha.d]# grep -v ^# /etc/ha.d/haresources
heartbeat1      IPaddr::10.0.0.50/24/eth0 drbddisk::data Filesystem::/dev/drbd0::/md1::ext4

转载于:https://blog.51cto.com/it1693/1680756

HeartBeat Install相关推荐

  1. Oracle 12c(12.1.0.5) oem agent silent install(静默安装agent)

    注释: 文章来自oracle support 文档 ID 1360083.1,静默安装agent采用的是把OMS服务端(即oem server端)的agent用压缩包download,远程传到agen ...

  2. centos6 搭建heartbeat

    Heartbeat是High-Availability Linux Project (Linux下的高可用性项目)的产物,是一套提供防止业务主机因不可避免的意外性或计划性宕机问题的高可用性软件.Hea ...

  3. 34补1-2_3 HA Cluster基础及heartbeat实现HA

    HA Cluster基础及heartbeat实现HA 配置环境 node1:192.168.1.121CentOS6.7 node2:192.168.1.122CentOS6.7 node3:192. ...

  4. 002.Heartbeat部署及httpd高可用

    一 前期准备 1.1 依赖准备 编译安装需要依赖的包,如gcc等: yum -y install gcc gcc-c++ make glibc kernel-devel kernel-headers ...

  5. Heartbeat双机热备配置

    Heartbeat双机热备配置 简介 Heartbeat 项目是 Linux-HA 工程的一个组成部分,它实现了一个高可用集群系统.心跳服务和集群通信是高可用集群的两个关键组件,在 Heartbeat ...

  6. Keepalived+LVS+Nginx+DRBD+Heartbeat+Zabbix集群架构

    2019独角兽企业重金招聘Python工程师标准>>> 本文由阿呆&zhdy合作完成! 一.准备工作: 1.1 6台模拟服务器: 确保每台机器 全部关闭 firewall 以 ...

  7. 轻松实现基于Heartbeat的高可用web服务集群

    高可用集群就是为了保证某项服务能够时时在线,我们可以通过几个9来衡量一个高可用集群提供服务的稳定性,例如5个9的高可用集群必须保证服务一年在线的时间占99.999%,也就是说一年的时间中仅允许服务电线 ...

  8. redhat5.8+heartbeat+web+nfs(提供软件包)

    Heartbeat+web+nfs Client            eth0:192.168.0.50 web master        eth0:192.168.0.115 web backu ...

  9. 2 构建Mysql+heartbeat+DRBD+LVS集群应用系统系列之MySql的搭建

    preface 上一节我们讲了DRBD的原理,以及如何部署DRBD,那么现在在上一节的基础上部署Mysql 安装并启动Mysql 为了方便,我一般采用yum安装Mysql.命令如下: 在172.16. ...

最新文章

  1. 智源博士后合作导师专访 | 曾毅:面向可持续发展的人工智能
  2. 15个产业级算法推出、35个高精度预训练模型上线!最强国产开源AI框架再进化,密集提升视觉产业实战能力...
  3. (八)Spring与MyBatis整合
  4. Java方法实现是什么意思_Java中实现可调用的最佳方法是什么,需要一段时间才能完成...
  5. CSDN 文章自动显示全文
  6. centos7 mysql安装_CentOS7安装MySQL(详解)
  7. 同济大学数学系高等数学第6版笔记和课后答案
  8. 视频自动生成字幕(免费版)
  9. HTML5前端设计——课表制作
  10. CSS Sprite雪碧图应用
  11. 跨境电商亚马逊平台运营模式有哪些?
  12. STM32实现DAC音频播放
  13. react-子传父案例(汇率转换)
  14. 原来这就是 UI 设计师的门槛
  15. SAP 登录的一些参数
  16. 中国剩余定理(也叫孙子定理)
  17. (三) 查看USB设备
  18. 2021年印度经济发展研究报告
  19. uniapp H5端 使用百度地图API
  20. Excel行列数字字母转换实现

热门文章

  1. plsql窗口文件怎么找回_电脑文件丢失怎么找回?知道原因和方法很关键
  2. oracle 文件写 n r,文本模式读写文件中\r和\n的问题
  3. linux中facl有什么作用,在Linux中使用setfacl后权限被拒绝
  4. 周报速递丨百度与美团等互联互通;京东Shopify达成合作
  5. 神策数据丨7 大分析云案例,揭开 232 亿美元市场的秘密
  6. NLP1 —— Python自然语言处理环境搭建
  7. HDU5706 GirlCat
  8. 经验之谈——送给年轻的职场人
  9. 我的家乡-客家小山村
  10. Work measurement II