温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

heartbeat安装

发布时间:2020-08-11 08:37:05 来源:网络 阅读:344 作者:古文强 栏目:软件技术

这里我就提供几个主要软件包了,其他的一些根据错误提示安装或提前安装完毕。

http://pan.baidu.com/share/link?shareid=2762183074&uk=1210957557

http://pan.baidu.com/share/link?shareid=2768037872&uk=1210957557

http://pan.baidu.com/share/link?shareid=2769389056&uk=1210957557


node1(主服务器):eth0:192.168.1.168(node1) eth2:192.168.1.183(priv1)

node2(从服务器):eth0:192.168.1.181(node2) eth2:192.168.1.182(priv2)

VIP地址:192.168.1.185(只需在heartbeat配置文件里写上即可)


node1和node2所有操作一样


[root@node1~]# vi /etc/hosts

192.168.1.168 node1

192.168.1.181 node2

192.168.1.183 priv1

192.168.1.182 priv2


[root@node1~]#groupadd -g 65 haclient

[root@node1~]#useradd -u 501 -g haclienthacluster


[root@node1~]#tar jxf /samba/Reusable-Cluster-Components-glue--glue-1.0.9.tar.bz2 -C /usr/local/src/

[root@node1~]#cd /usr/local/src/Reusable-Cluster-Components-glue--glue-1.0.9/

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9]#./autogen.sh

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9]#./configure --prefix=/usr/local/ha/

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9]#make

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9]#make install


[root@node1Reusable-Cluster-Components-glue--glue-1.0.9]#tar jxf /samba/Cluster-Resource-Agents-5ae70412eec8.tar.bz2 -C ./

[root@node1Reusable-Cluster-Components-glue--glue-1.0.9]#cd /usr/local/src/Cluster-Resource-Agents-5ae70412eec8/

[root@node1Cluster-Resource-Agents-5ae70412eec8]#./autogen.sh

[root@node1Cluster-Resource-Agents-5ae70412eec8]#./configure --prefix=/usr/local/ha/

[root@node1Cluster-Resource-Agents-5ae70412eec8]#make

[root@node1Cluster-Resource-Agents-5ae70412eec8]#make install

[root@node1Cluster-Resource-Agents-5ae70412eec8]#cd ..


[root@node1src]#tar jxf /samba/Heartbeat-3-0-STABLE-3.0.4.tar.bz2 -C ./

[root@node1src]#cd Heartbeat-3-0-STABLE-3.0.4/

[root@node1Heartbeat-3-0-STABLE-3.0.4]# ./bootstrap

[root@node1Heartbeat-3-0-STABLE-3.0.4]#./configure --prefix=/usr/local/ha/

[root@node1Heartbeat-3-0-STABLE-3.0.4]#gmake

[root@node1Heartbeat-3-0-STABLE-3.0.4]#make install


[root@node1Heartbeat-3-0-STABLE-3.0.4]#chkconfig --add heartbeat


[root@node1Heartbeat-3-0-STABLE-3.0.4]#cp /usr/local/ha/share/doc/heartbeat/haresources /usr/local/ha/etc/ha.d/

[root@node1Heartbeat-3-0-STABLE-3.0.4]#cp /usr/local/ha/share/doc/heartbeat/authkeys /usr/local/ha/etc/ha.d/

[root@node1Heartbeat-3-0-STABLE-3.0.4]#cp /usr/local/ha/share/doc/heartbeat/ha.cf /usr/local/ha/etc/ha.d/

[root@node1Heartbeat-3-0-STABLE-3.0.4]#chmod 600 /usr/local/ha/etc/ha.d/authkeys

[root@node1Heartbeat-3-0-STABLE-3.0.4]#cd /usr/local/ha/etc/ha.d/

[root@node1ha.d]#vi authkeys    //我选择的是第一种验证模式

heartbeat安装

[root@node1ha.d]#vi ha.cf

#去掉以***释

debugfile /var/log/ha-debug    //debug消息存放路径

logfile /var/log/ha-log    //heartbeat日志存放路径

keepalive 2          //指定心跳时间间隔是2秒

deadtime 30         //指定奋勇借点在30秒内没有收到主节点的心跳信号后,则立即接管主节点的服务资源

warntime 10          //指定心跳延迟时间为10秒,当10秒钟内备份节点收取不到主节点的心跳信号时,就会让日志中写入一个警告信息,但此时不会切换服务

initdead 120        //在某些配置上,系统启动或重启之后需要经过一段时间网络才能正常工作,该选项用于解决这种情况产生的时间间隔,取值至少为deadtime的两倍

udp port 694          //设置广播通信使用的端口,默认为694

baud 19200        //设置串行通信的波特率

bcast eth2       //表示在eth2接口上使用以太网广播方式

auto_failback on      //用来定义当主节点恢复后,是否将服务自动切回,heartbeat的两台主机分别为主节点和备份节点。主节点在正常情况下占用资源并运行所有的服务,遇到故障时把资源交给备份节点并由备份节点运行服务。在该选项设为on的情况下,一旦主节点恢复运行,则自动获取资源并取代备份节点,如果该选项设置为off,那么当主节点恢复后,将变为备份节点,而原来的备份节点成为主节点

node node1        //主节点主机名

node node2        //备用节点主机名

ping 192.168.1.1      //选择ping的节点,ping节点选择的越好,则HA集群就更强壮

ping_group group1 192.168.1.100 192.168.1.150  //类似于ping

apiauthpingdgid=haclientuid=hacluster


[root@node1ha.d]#vi haresources

node1 IPaddr::192.168.1.185 httpd       //node1为主节点主机名 ,IPaddr为heartbeat自带的一个执行脚本,192.168.1.185为VIP地址,httpd表示启动httpd服务


node1做完后继续做node2,配置是一样的,我就不重复说明了,都安装配置完毕后再node1上ifconfig看看是否有VIP地址了

heartbeat安装

node1和node2都已经配置好了apache服务,现在用VIP地址访问就可以访问node1上的apache网站,node1如宕机了,node2会在指定的时候替代上去,那时访问的就是node2上apache网站

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI