设为首页 收藏本站
查看: 1018|回复: 0

[经验分享] heartbeat3.0.4安装配置详解

[复制链接]
发表于 2019-1-6 14:30:04 | 显示全部楼层 |阅读模式
(一) 环境说明  操作系统:centos 5.4 x86_64
  节点1:
  主机名:aos
  Ip:xxxxx.82
  节点2:
  主机名:weibo
  Ip:xxxx.82
  注意:2个节点都要在各自的hosts文件中指定节点主机名和ip的对应关系,在ha.cf中node参数指定的主机名要和uname –a,host文件里指定的相同

(二) heartbeat3.0组成  heartbeat3.0版本有三部分组成:Heartbeat、Cluster Glue、Resource Agents
  1、hearbeat本身是整个集群的基础(cluster messaging layer),负责维护集群各节点的信息以及它们之前通信;
  2、cluster-glue相当于一个中间层,可以将heartbeat和crm(pacemaker)联系起来,主要包含2个部分,LRM和STONITH;
  3、resource-agent,就是各种的资源的ocf脚本,这些脚本将被LRM调用从而实现各种资源启动、停止、监控等等。
(三) 创建用户和组  [root@aos ha.d]# groupadd haclient
  [root@aos ha.d]# useradd hacluster -g haclient -s /sbin/nologin
(四) 安装 ? 安装Cluster-Glue  #tar jvxf Reusable-Cluster-Components-glue--glue-1.0.7.tar.bz2
  #cd Reusable-Cluster-Components-glue--glue-1.0.7
  #./autogen.sh

  #./configure --prefix=/usr/local/ha_soft
  #make
  #make install
? 安装resource-agent  #cd ..
  #tar zvxf ClusterLabs-resource-agents-agents-1.0.4-0-gc06b6f3.tar.gz
  #cd ClusterLabs-resource-agents-c06b6f3/
  #./autogen.sh

  #./configure --prefix=/usr/local/ha_soft CFLAGS=-I/usr/local/ha_soft/include LDFLAGS=-L/usr/local/ha_soft/lib
  #cp /usr/local/ha_soft/include/heartbeat/glue_config.h /usr/local/ha_soft/include/heartbeat/glue_config.h.bak
  #vi /usr/local/ha_soft/include/heartbeat/glue_config.h(找到如下几个设置项删除对应的行)
  HA_SYSCONFDIR
  HA_HBCONF_DIR
  HA_HBCONF_DIR
  #make
  #vim /etc/ld.so.conf.d/heartbeat.conf(输入如下行)
  /usr/local/ha_soft/lib
  #ldconfig
  #make install
? 安装heartbeat  #cd ..
  #tar jvxf Heartbeat-3-0-STABLE-3.0.4.tar.bz2
  #cd Heartbeat-3-0-STABLE-3.0.4
  # ./bootstrap

  #./configure --prefix=/usr/local/ha_soft CFLAGS=-I/usr/local/ha_soft/include LDFLAGS=-L/usr/local/ha_soft/lib
  #cp /srv/Heartbeat-3-0-STABLE-3.0.4/lib/plugins/HBcomm/hbaping.c /srv/Heartbeat-3-0-STABLE-3.0.4/lib/plugins/HBcomm/hbaping.c.bak
  # vim /srv/Heartbeat-3-0-STABLE-3.0.4/lib/plugins/HBcomm/hbaping.c(安装源码目录,删除326行)
  #make
  #make install
(五) 配置(节点1和节点2相同,区别就是检查ip是对方) ? 从源码编译目录中复制配置文件到安装目录  复制附件里的配置文件到 /usr/local/ha_soft/etc/ha.d/
? 编辑ha.cf 主配置文件  [root@aos ha.d]# cd /usr/local/ha_soft/etc/ha.d
  [root@aos ha.d]# vim ha.cf
  #debugfile /var/log/ha-debug
  #logfile /var/log/ha-log
  logfacility local0
  keepalive 2
  deadtime 6
  warntime 4
  initdead 30
  udpport 694
  ucast eth1 192.168.1.200
  auto_failback off
  node aos
  node weibo
  compression bz2
  compression_threshold 2
  ping_group group1 xxxxx82 xxxx.80
  respawn root /usr/local/ha_soft/lib/heartbeat/ipfail
  apiauth ipfail gid=root uid=root
  debug 0
? 编辑authkeys 验证信息文件  [root@aos ha.d]# cd /usr/local/ha_soft/etc/ha.d
  [root@aos ha.d]# vim authkeys
  auth 1
  1 crc
  [root@aos ha.d]# chmod 600 authkeys
? 编辑haresources 资源控制配置文件  [root@aos ha.d]# cd /usr/local/ha_soft/etc/ha.d
  [root@aos ha.d]# vim haresources
  aos IPaddr::xxxxx.70/25/eht0/xxxxx.127
? 链接文件  [root@aos heartbeat]# vim /etc/ld.so.conf(加入到文件末尾)
  /usr/local/ha_soft/lib/
  [root@aos heartbeat]# ldconfig
  #cp /usr/local/ha_soft/etc/ha.d/resource.d/hto-mapfuncs /usr/local/ha_soft/etc/ha.d/resource.d/hto-mapfuncs.bak
  [root@aos heartbeat]# vim +35 /usr/local/ha_soft/etc/ha.d/resource.d/hto-mapfuncs(注释35行)
(六) 注册并且启动服务  [root@aos ha.d]# chkconfig --add heartbeat
  [root@aos ha.d]# chkconfig levles 2345 heartbeat on
  [root@aos ha.d]# /etc/init.d/heartbeat start



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-659996-1-1.html 上篇帖子: DRBD+Heartbeat+NFS实验笔记 下篇帖子: heartbeat 双机的热备份
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表