zoukankan      html  css  js  c++  java
  • centos6.x下yum安装heartbeat

    [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

  • 相关阅读:
    0-1性能测试需求分析
    1-10jmeter关联,正则表达式(待巩固)
    1-9jmeter集合点,并发操作
    1-8.jmeter设置断言(检查点)
    1-6jmeter性能测试基础
    泛型中的协变和逆变
    jsPlumb
    jQuery UI vs Kendo UI & jQuery Mobile vs Kendo UI Mobile
    31天重构
    Visual Studio 小工具
  • 原文地址:https://www.cnblogs.com/blog-tim/p/10764280.html
Copyright © 2011-2022 走看看