centos6.x下yum安装heartbeat

Posted blog-tim

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.x下yum安装heartbeat相关的知识,希望对你有一定的参考价值。

[[email protected] ~]# uname -n   #<===配置heartbeat时,节点的主机名必须和 uname -n 命令的结果要一致
heartbeat
[[email protected] ~]# crontab -l  #<===时间同步很重要
#ntpdate by root
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com &>/dev/null
[[email protected] ~]# release=`grep -o "[0-9]" /etc/redhat-release | head -1`
[[email protected] ~]# 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
[[email protected] ~]# yum -y install heartbeat      #<===centos6.x下yum默认安装heartbeat版本是3.0.4,centos7.x下只能编译安装
[[email protected] ~]# cd /usr/share/doc/heartbeat-3.0.4/
[[email protected] heartbeat-3.0.4]# cp {ha.cf,haresources,authkeys} /etc/ha.d/
[[email protected] heartbeat-3.0.4]# cd /etc/ha.d/
[[email protected] ha.d]# chmod 600 /etc/ha.d/authkeys 
[[email protected] ha.d]# ip addr add 10.0.0.30/24 broadcast 10.0.0.255 dev eth0   #<===添加辅助VIP
[[email protected] 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
[[email protected] ha.d]# cat authkeys
auth 1
1 sha1 LfW+BX0CQVLls1hrumK9ejVCcfk=
[[email protected] ha.d]# cat haresources
#config by root
heartbeat IPaddr::10.0.0.30/24/eth0
#heartbeat2 IPaddr::10.0.0.60/24/eth0
[[email protected] ha.d]# ll /etc/init.d/heartbeat 
-rwxr-xr-x. 1 root root 10485 Dec 3 2013 /etc/init.d/heartbeat
[[email protected] ~]# /etc/init.d/heartbeat start
Starting High-Availability services: INFO: Resource is stopped
Done.
[[email protected] ~]# 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
[[email protected] ha.d]# chkconfig --add heartbeat
[[email protected] 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的主要内容,如果未能解决你的问题,请参考以下文章

CentOS6.x/6.5/6.4/6.3/6.2/7.x 64位安装php5.2(使用YUM自动安装)

heartbeat 非联网安装(通过配置本地yum文件库安装heartbeat)

centos6.x安装yum及python依赖包

Linux 之 在最小化安装情况下安装图形界面

032-Centos下安装Git工具

Centos6.x系统下安装telnet命令及使用