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

[经验分享] HA高可用方案之heartbeat v1的安装配置

[复制链接]

尚未签到

发表于 2019-1-7 11:21:25 | 显示全部楼层 |阅读模式
  配置前提:

  1.时间必须同步,建议使用ntp协议
  2.节点之间必须要通过主机名互相通信;通信中使用的名字必须与其节点上"uname -n"命令展示出的名字一致
  3.需要仲裁设备
  4.双方root用户能基于ssh密钥方式进行通信
  5.本地资源必须能够正常运行,本文将使用httpd作为案例

             注意:定义为集群服务中的任意资源都不能开机自动启动,因为他们将由CRM启动
  安装方法:
  
[root@nod1 heartbeat1]# yum -y install net-snmp-libs libnet PyXML libltdl   注意配置epel源
[root@nod1 heartbeat1]# rpm -ivh heartbeat-2.1.4-12.el6.i686.rpm heartbeat-stonith-2.1.4-12.el6.i686.rpm heartbeat-pils-2.1.4-12.el6.i686.rpm  
Preparing...                ########################################### [100%]
   1:heartbeat-pils         ########################################### [ 33%]
   2:heartbeat-stonith      ########################################### [ 67%]
   3:heartbeat              ########################################### [100%]  
  同步时间:
  

crontab */3 * * * * /usr/sbin/ntpdate 172.16.0.1 &> /dev/null  节点1:建立加密关联
ssh-keygen -P ''ssh-copey-id -i .ssh/id_rsa.pub root@node2[root@nod1 ~]# ssh nod2 'date';date   保持两个节点时间同步Mon Oct  5 17:38:47 HKT 2015Mon Oct  5 17:38:47 HKT 2015[root@nod1 ~]# scp /etc/hosts nod2:/etc/hosts    两个节点的hosts文件保持一致hosts                                                 100%  228     0.2KB/s   00:00[root@nod2 ~]# ssh-keygen -t rsa -P ''       确保nod2加密连接到nod1
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
b0:bc:2e:44:88:6e:7b:a7:d0:63:f6:9f:4f:f8:4d:55 root@nod2.mageedu.com
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
| . .  .        E |
|. . .. o      .  |
|.  .  o S    .   |
| o. .  ..   .    |
|...*  .. . .     |
| .+.+o  + o      |
|  ..oooo.o .     |
+-----------------+[root@nod2 ~]# ssh-copy-id -i .ssh/id_rsa.pub root@nod1The authenticity of host 'nod1 (192.168.1.10)' can't be established.RSA key fingerprint is 41:26:a8:88:6a:93:f6:56:aa:87:6b:d7:62:46:83:0d.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'nod1,192.168.1.10' (RSA) to the list of known hosts.root@nod1's password: Now try logging into the machine, with "ssh 'root@nod1'", and check in:   .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. [root@nod2 ~]# ssh nod1 'date';dateMon Oct  5 17:45:26 HKT 2015Mon Oct  5 17:45:26 HKT 2015  配置文件设置;
cd /usr/share/doc/heartbeat-2.1.4cp -p authkeys haresources ha.cf /etc/ha.d   #将备用的配置文件拷贝到配置目录中   ha.cf:heartbeat的主配置文件,authkeys:集群信息加密算法及密钥,haresources:heartbeat v1的CRM配置接口cd /etc/ha.d/chmod 600 authkeys   修改权限400或600  修改ha.cf配置:
vim ha.cflogfile /var/log/ha-log#logfacility    local0mcast eth0 228.203.101.1 694 1 0  采用多播地址,本地组播地址:239.0.0.0-239.255.255.255,仅在特定的本地范围内有效 node nod1.mageedu.comnode nod2.mageedu.com   加入高可用集群的计算机ping  192.168.1.1  仲裁设备,判断计算机是否可用的标准compression bz2  选择压缩  vim authkeys    auth 1   1 sha1  343434349   设置加密,可以使用openssl rand -hex 6生成加密密码  vim haresouces:  nod1.mageedu.com 192.168.1.15/24/eth0/192.168.1.255 httpd    Haresources文件用于指定双机系统的主节点、集群IP、子网掩码、广播地址以及启动的服务等集群资源sscp -p authkeys haresouces ha.cf node2:/etc/ha.d/  确保主机2 配置,文件属性相同-pservice heartbeart start; ssh node2 'service heartbeat start'启动服务,访问外网地址能正常访问

  
tail /var/log/ha-log 查看日志  cd /usr/lib64/heartbeat/    ./hb_standby 不作为主    ./hb_takeover 作为主 资源转化用  





运维网声明 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-660303-1-1.html 上篇帖子: CentOS5.8 HA集群之基于crm配置 heartbeat + nfs + httpd 下篇帖子: RHEL下部署heartbeat,实现简单故障转移群集
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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

扫描微信二维码查看详情

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


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


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


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



合作伙伴: 青云cloud

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