[root@heartbeat ~]# uname -n   #<===配置heartbeat时,节点的主机名必须和 uname -n 命令的结果要一致
heartbeat
[root@heartbeat ~]# crontab -l #<===时间同步很重要
#ntpdate by root
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com &>/dev/null
[root@heartbeat ~]# release=`grep -o "[0-9]" /etc/redhat-release | head -1`
[root@heartbeat ~]# cat <<eof>/etc/yum.repos.d/epel.repo
> [epel]
> name=epelrepo
> baseurl=https://mirrors.aliyun.com/epel/${release}Server/\$basearch
> gpgcheck=0
> enable=1
> eof
[root@heartbeat ~]# yum -y install heartbeat #<===centos6.x下yum默认安装heartbeat版本是3.0.4,centos7.x下只能编译安装
[root@heartbeat ~]# cd /usr/share/doc/heartbeat-3.0.4/
[root@heartbeat heartbeat-3.0.4]# cp {ha.cf,haresources,authkeys} /etc/ha.d/
[root@heartbeat heartbeat-3.0.4]# cd /etc/ha.d/
[root@heartbeat ha.d]# chmod 600 /etc/ha.d/authkeys
[root@heartbeat ha.d]# ip addr add 10.0.0.30/24 broadcast 10.0.0.255 dev eth0 #<===添加辅助VIP
[root@heartbeat ha.d]# cat ha.cf
#configure start by root
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local1 keepalive 2
deadtime 30
warntime 10
initdead 60 #bcast eth1
mcast eth0 225.0.0.20 694 1 0 auto_failback on
node heartbeat
#node heartbeat2
crm no #configure end by root
[root@heartbeat ha.d]# cat authkeys
auth 1
1 sha1 LfW+BX0CQVLls1hrumK9ejVCcfk=
[root@heartbeat ha.d]# cat haresources
#config by root
heartbeat IPaddr::10.0.0.30/24/eth0
#heartbeat2 IPaddr::10.0.0.60/24/eth0
[root@heartbeat ha.d]# ll /etc/init.d/heartbeat
-rwxr-xr-x. 1 root root 10485 Dec 3 2013 /etc/init.d/heartbeat
[root@heartbeat ~]# /etc/init.d/heartbeat start
Starting High-Availability services: INFO: Resource is stopped
Done.
[root@heartbeat ~]# netstat -lntup|grep heartbeat
udp 0 0 0.0.0.0:35586 0.0.0.0:* 1525/heartbeat: wri
udp 0 0 225.0.0.20:694 0.0.0.0:* 1525/heartbeat: wri
[root@heartbeat ha.d]# chkconfig --add heartbeat
[root@heartbeat ha.d]# chkconfig --level 3 heartbeat on

以上是单台heartbeat服务器配置,生产中双机热备heartbeat配置文件{ha.cf,authkeys,haresources}内容是一样的,这里心跳线配置步骤省略....

如遇安装报错,查看 /var/log/ha-log日志排查错误即可,heartbeat相对来说还是简单的。

更多详细知识参考好友博客 http://www.cnblogs.com/f-ck-need-u/p/8587882.html

centos6.x下yum安装heartbeat的更多相关文章

  1. CentOS6.5下 yum安装LAMP

    CentOS下yum安装LAMP   1. 用yum安装Apache,Mysql,PHP. 1.1安装Apache yum install httpd httpd-devel 安装完成后,用/etc/ ...

  2. centos6.5下yum安装lnmp(适合刚入职的新手的方法)

    新入职的员工,开始的时候都是让配环境,本地写代码用的wamp,在lnmp或lamp测试,除非有些土豪公司 用的是(果机). 另外安装时,把整个流程在脑子里先过一篇(记不全也没关系,一回生二回熟),重在 ...

  3. centos6.3下yum安装redis

    我得是centos 6.3,如果直接用yum安装redis,报错,如下: [root@CentOS6 etc]# yum install redis Loaded plugins: fastestmi ...

  4. CentOS6.x下yum安装MySQL5.5/5.6

    1. 安装mysql-5.5的yum源 # rpm -ivh http://repo.mysql.com/yum/mysql-5.5-community/el/6/x86_64/mysql-commu ...

  5. centos6.5下yum安装mysql5.5

    第一步就是看linu是否安装了mysql,经过rpm -qa|grep mysql查看到centos下安装了mysql5.1,那就开始卸载咯 2 接下来就是卸载mysql5.1了,命令:rpm -e ...

  6. Centos6.8下yum安装python2.7

    下载 ius-release.rpm包 wget https://centos6.iuscommunity.org/ius-release.rpm 安装ius-release.rpm包 rpm -Uv ...

  7. CentOS6.10下yum安装MySQL5.7

    MySQL官网的Yum仓库快速指南:https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/ 检查是否安装有MySQL数据库 rpm -qa | ...

  8. centos6下yum安装mariadb数据库的解决方法

    在centos6下Yum安装mariadb数据库时老是提示无法正常安装,看错误日志才发现,是没有mariadb release源文件在/etc/yum.repos.d/中,为此,我特意在新建文件: # ...

  9. centos6.7下编译安装lnmp

    很多步骤不说明了,请参照本人的centos6.7下编译安装lamp,这次的架构是nginx+php-fpm一台服务器,mysql一台服务器 (1)首先编译安装nginx: 操作命令: yum -y g ...

随机推荐

  1. 轻松弄懂var、let、const之间的区别

    ECMAScript 6(简称ES6)是JavaScript语言的下一代标准,于2015年6月正式发布,也称ECMAScript 2015. ES6的好处 ES6的出现为我们前端带来了很多方便之处,以 ...

  2. 月薪30k的Java架构师JVM常见面试题解析

    在做程序员的路上经常会遇到的JVM一些经典面试题,今天给大家分享出我自己的解题思路,希望对大家有帮助,后续有空会持续更新. 1.什么情况下会发生栈内存溢出. 思路: 描述栈定义,再描述为什么会溢出,再 ...

  3. 测试工具Fiddler(三)—— 常见功能介绍

    Fiddler的功能面板 1.statistics:请求的性能指标:全世界范围的性能测试: RTP:一个请求的从发送出去到返回的时间: Show chart可以看出图表的示例: 2.inspector ...

  4. auth.User.groups: (fields.E304) Reverse accessor for 'User.groups'

    创建表,运行下面命令,出错 makemigrations 原因:继承auth_user 解决方案 在settings.py文件添加 AUTH_USER_MODEL = "app名称.类名&q ...

  5. 5.Switch多选择结构

    Switch语句: 多选择结构还有一个实现方式就是 switch case 语句 switch case 语句判断一个变量与一系列值中的某个值是否相等,每个值称为一个分支. switch语句中的变量类 ...

  6. 信息: TLD skipped. URI: http://www.fusioncharts.com/jsp/core is already defined

    二月 02, 2018 11:43:28 上午 org.apache.catalina.startup.TaglibUriRule body 信息: TLD skipped. URI: http:// ...

  7. RabbitMQ入门(三)订阅模式

      在之前的文章RabbitMQ入门(二)工作队列中,我们创建了一个工作队列.工作队列背后的假设是每一项任务都被准确地传送至一个worker.在本文中,我们将会做一些不同的事情--我们将会把一个消息发 ...

  8. Eclipse CDT 插件修改自动补全

    eclipse CDT 2019-06代码补全插件 本自动补全文件已在2019-06至2019-09平台上做过测试,均已完美通过功能检测 在原来Eclipse工具补全的基础上新增26个英文字符和&qu ...

  9. Can you answer these queries III(线段树)

    Can you answer these queries III(luogu) Description 维护一个长度为n的序列A,进行q次询问或操作 0 x y:把Ax改为y 1 x y:询问区间[l ...

  10. Algorithm: 多项式乘法 Polynomial Multiplication: 快速傅里叶变换 FFT / 快速数论变换 NTT

    Intro: 本篇博客将会从朴素乘法讲起,经过分治乘法,到达FFT和NTT 旨在能够让读者(也让自己)充分理解其思想 模板题入口:洛谷 P3803 [模板]多项式乘法(FFT) 朴素乘法 约定:两个多 ...