码迷,mamicode.com
首页 > 其他好文 > 详细

centos6.x下yum安装heartbeat

时间:2019-04-24 19:30:33      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:chmod   auth   tde   kconfig   configure   tar   sha   base   eth0   

[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

标签:chmod   auth   tde   kconfig   configure   tar   sha   base   eth0   

原文地址:https://www.cnblogs.com/blog-tim/p/10764280.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!