HeartBeat Install
測試配置:
[root@centos6-1 ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@centos6-1 ~]# uname -r
2.6.32-504.el6.x86_64
[root@centos6-1 ~]# uname -a
Linux centos6-1 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
?
測試機A:
[root@centos6-1 ~]# ifconfig |egrep 'eth|addr:10'
eth0????? Link encap:Ethernet? HWaddr 00:0C:29:D1:B0:4C?
????????? inet addr:10.0.0.16? Bcast:10.0.0.255? Mask:255.255.255.0
eth1????? Link encap:Ethernet? HWaddr 00:0C:29:D1:B0:56?
????????? inet addr:10.0.1.16? Bcast:10.0.1.255? Mask:255.255.255.0
[root@centos6-1 ~]# echo 10.0.0.16 centos6-1 >> /etc/hosts
[root@centos6-1 ~]# echo 10.0.0.26 centos6-2 >> /etc/hosts
測試機B:
[root@centos6-2 ~]#? ifconfig |egrep 'eth|addr:10'
eth0????? Link encap:Ethernet? HWaddr 00:0C:29:A7:54:29?
????????? inet addr:10.0.0.26? Bcast:10.0.0.255? Mask:255.255.255.0
eth1????? Link encap:Ethernet? HWaddr 00:0C:29:A7:54:33?
????????? inet addr:10.0.1.26? Bcast:10.0.1.255? Mask:255.255.255.0
[root@centos6-1 ~]# echo 10.0.0.16 centos6-1 >> /etc/hosts
[root@centos6-1 ~]# echo 10.0.0.26 centos6-2 >> /etc/hosts
?
互ping測試:
[root@centos6-1 ~]# ping centos6-2
PING centos6-2 (10.0.0.26) 56(84) bytes of data.
64 bytes from centos6-2 (10.0.0.26): icmp_seq=1 ttl=64 time=0.282 ms
64 bytes from centos6-2 (10.0.0.26): icmp_seq=2 ttl=64 time=0.440 ms
64 bytes from centos6-2 (10.0.0.26): icmp_seq=3 ttl=64 time=0.365 ms
[root@centos6-2 ~]# ping centos6-1
PING centos6-1 (10.0.0.16) 56(84) bytes of data.
64 bytes from centos6-1 (10.0.0.16): icmp_seq=1 ttl=64 time=0.318 ms
?
配置心跳線直連
添加主機路由
root@centos6-1 ~]# /sbin/route add -host 10.0.0.26 dev eth1
[root@centos6-2 ~]# /sbin/route add -host 10.0.0.16 dev eth1
?
添加開機啟動
[root@centos6-1 ~]# echo '/sbin/route add -host 10.0.0.26 dev eth1' >> /etc/rc.local
[root@centos6-2 ~]# echo '/sbin/route add -host 10.0.0.16 dev eth1' >> /etc/rc.local
下載并安裝 epel包
[root@centos6-2 tools]# wget http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
--2015-07-17 21:47:01--? http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
Resolving mirrors.ustc.edu.cn... 202.141.160.110, 2001:da8:d800:95::110
Connecting to mirrors.ustc.edu.cn|202.141.160.110|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14540 (14K) [application/x-redhat-package-manager]
Saving to: “epel-release-6-8.noarch.rpm”
100%[========================================================================>] 14,540????? 87.7K/s?? in 0.2s???
2015-07-17 21:47:02 (87.7 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540]
[root@centos6-2 tools]# ls
epel-release-6-8.noarch.rpm
[root@centos6-2 tools]# rpm -ivh epel-release-6-8.noarch.rpm
warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...??????????????? ########################################### [100%]
?? 1:epel-release?????????? ########################################### [100%]
?
yum安裝HeartBeat
[root@centos6-2 tools]# yum install heartbeat*
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
epel/metalink????????????????????????????????????????????????????????????????????????????? | 3.5 kB???? 00:00????
* base: mirror.bit.edu.cn
* epel: mirror.premi.st
* extras: mirror.bit.edu.cn
* updates: mirror.neu.edu.cn
epel?????????????????????????????????????????????????????????????????????????????????????? | 4.4 kB???? 00:00????
epel/primary_db??????????????????????????????????????????????????????????????????????????? | 6.7 MB???? 00:48????
Resolving Dependencies
--> Running transaction check
---> Package heartbeat.x86_64 0:3.0.4-2.el6 will be installed
--> Processing Dependency: resource-agents for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: cluster-glue-libs for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: cluster-glue for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: PyXML for package: heartbeat-3.0.4-2.el6.x86_64
--> Processing Dependency: libplumb.so.2()(64bit) for package: heartbeat-3.0.4-2.el6.x86_64
---> Package heartbeat-devel.x86_64 0:3.0.4-2.el6 will be installed
---> Package heartbeat-libs.x86_64 0:3.0.4-2.el6 will be installed
--> Running transaction check
---> Package PyXML.x86_64 0:0.8.4-19.el6 will be installed
---> Package cluster-glue.x86_64 0:1.0.5-6.el6 will be installed
--> Processing Dependency: perl-TimeDate for package: cluster-glue-1.0.5-6.el6.x86_64
---> Package cluster-glue-libs.x86_64 0:1.0.5-6.el6 will be installed
---> Package resource-agents.x86_64 0:3.9.5-12.el6_6.7 will be installed
--> Running transaction check
---> Package perl-TimeDate.noarch 1:1.16-13.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==================================================================================================================
Package???????????????????????? Arch???????????????? Version???????????????????????? Repository???????????? Size
==================================================================================================================
Installing:
heartbeat?????????????????????? x86_64?????????????? 3.0.4-2.el6???????????????????? epel????????????????? 161 k
heartbeat-devel???????????????? x86_64?????????????? 3.0.4-2.el6???????????????????? epel????????????????? 123 k
heartbeat-libs????????????????? x86_64?????????????? 3.0.4-2.el6???????????????????? epel????????????????? 263 k
Installing for dependencies:
PyXML?????????????????????????? x86_64?????????????? 0.8.4-19.el6??????????????????? base????????????????? 892 k
cluster-glue??????????????????? x86_64?????????????? 1.0.5-6.el6???????????????????? base?????????????????? 71 k
cluster-glue-libs?????????????? x86_64?????????????? 1.0.5-6.el6???????????????????? base????????????????? 116 k
perl-TimeDate?????????????????? noarch?????????????? 1:1.16-13.el6?????????????????? base?????????????????? 37 k
resource-agents???????????????? x86_64?????????????? 3.9.5-12.el6_6.7??????????????? updates?????????????? 357 k
Transaction Summary
==================================================================================================================
Install?????? 8 Package(s)
Total download size: 2.0 M
Installed size: 6.9 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): PyXML-0.8.4-19.el6.x86_64.rpm?????????????????????????????????????????????????????? | 892 kB???? 00:12????
(2/8): cluster-glue-1.0.5-6.el6.x86_64.rpm???????????????????????????????????????????????? |? 71 kB???? 00:01????
(3/8): cluster-glue-libs-1.0.5-6.el6.x86_64.rpm??????????????????????????????????????????? | 116 kB???? 00:00????
(4/8): heartbeat-3.0.4-2.el6.x86_64.rpm??????????????????????????????????????????????????? | 161 kB???? 00:00????
(5/8): heartbeat-devel-3.0.4-2.el6.x86_64.rpm????????????????????????????????????????????? | 123 kB???? 00:00????
(6/8): heartbeat-libs-3.0.4-2.el6.x86_64.rpm?????????????????????????????????????????????? | 263 kB???? 00:00????
(7/8): perl-TimeDate-1.16-13.el6.noarch.rpm??????????????????????????????????????????????? |? 37 kB???? 00:00????
(8/8): resource-agents-3.9.5-12.el6_6.7.x86_64.rpm???????????????????????????????????????? | 357 kB???? 00:00????
------------------------------------------------------------------------------------------------------------------
Total???????????????????????????????????????????????????????????????????????????? 104 kB/s | 2.0 MB???? 00:19????
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-8.noarch (installed)
From?? : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
? Installing : cluster-glue-libs-1.0.5-6.el6.x86_64?????????????????????????????????????????????????????????? 1/8
? Installing : 1:perl-TimeDate-1.16-13.el6.noarch???????????????????????????????????????????????????????????? 2/8
? Installing : cluster-glue-1.0.5-6.el6.x86_64??????????????????????????????????????????????????????????????? 3/8
? Installing : PyXML-0.8.4-19.el6.x86_64????????????????????????????????????????????????????????????????????? 4/8
? Installing : resource-agents-3.9.5-12.el6_6.7.x86_64??????????????????????????????????????????????????????? 5/8
? Installing : heartbeat-libs-3.0.4-2.el6.x86_64????????????????????????????????????????????????????????????? 6/8
? Installing : heartbeat-3.0.4-2.el6.x86_64?????????????????????????????????????????????????????????????????? 7/8
? Installing : heartbeat-devel-3.0.4-2.el6.x86_64???????????????????????????????????????????????????????????? 8/8
? Verifying? : cluster-glue-libs-1.0.5-6.el6.x86_64?????????????????????????????????????????????????????????? 1/8
? Verifying? : resource-agents-3.9.5-12.el6_6.7.x86_64??????????????????????????????????????????????????????? 2/8
? Verifying? : PyXML-0.8.4-19.el6.x86_64????????????????????????????????????????????????????????????????????? 3/8
? Verifying? : heartbeat-libs-3.0.4-2.el6.x86_64????????????????????????????????????????????????????????????? 4/8
? Verifying? : heartbeat-devel-3.0.4-2.el6.x86_64???????????????????????????????????????????????????????????? 5/8
? Verifying? : heartbeat-3.0.4-2.el6.x86_64?????????????????????????????????????????????????????????????????? 6/8
? Verifying? : cluster-glue-1.0.5-6.el6.x86_64??????????????????????????????????????????????????????????????? 7/8
? Verifying? : 1:perl-TimeDate-1.16-13.el6.noarch???????????????????????????????????????????????????????????? 8/8
Installed:
? heartbeat.x86_64 0:3.0.4-2.el6??? heartbeat-devel.x86_64 0:3.0.4-2.el6??? heartbeat-libs.x86_64 0:3.0.4-2.el6??
Dependency Installed:
? PyXML.x86_64 0:0.8.4-19.el6???????????????????????????????? cluster-glue.x86_64 0:1.0.5-6.el6??????????????????
? cluster-glue-libs.x86_64 0:1.0.5-6.el6????????????????????? perl-TimeDate.noarch 1:1.16-13.el6?????????????????
? resource-agents.x86_64 0:3.9.5-12.el6_6.7?????????????????
Complete!
?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[root@centos6-2 ~]# yum search heartbeat
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirror.bit.edu.cn
* epel: mirror.premi.st
* extras: mirror.bit.edu.cn
* updates: mirror.neu.edu.cn
epel/pkgtags?????????????????????????????????????????????????????????????????????????????? | 1.6 MB???? 00:39????
============================================= N/S Matched: heartbeat =============================================
heartbeat-devel.i686 : Heartbeat development package
heartbeat-devel.x86_64 : Heartbeat development package
heartbeat-libs.i686 : Heartbeat libraries
heartbeat-libs.x86_64 : Heartbeat libraries
heartbeat.x86_64 : Messaging and membership subsystem for High-Availability Linux
pacemaker.x86_64 : Scalable High-Availability cluster resource manager
resource-agents.x86_64 : Open Source HA Reusable Cluster Resource Scripts
? Name and summary matches only, use "search all" for everything.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
?
?
HeartBeat 模板配置文件
[root@centos6-2 ~]# ll /usr/share/doc/heartbeat-3.0.4/
total 144
-rw-r--r--. 1 root root? 1873 Dec? 3? 2013 apphbd.cf
-rw-r--r--. 1 root root?? 645 Dec? 3? 2013 authkeys
-rw-r--r--. 1 root root? 3701 Dec? 3? 2013 AUTHORS
-rw-r--r--. 1 root root 58752 Dec? 3? 2013 ChangeLog
-rw-r--r--. 1 root root 17989 Dec? 3? 2013 COPYING
-rw-r--r--. 1 root root 26532 Dec? 3? 2013 COPYING.LGPL
-rw-r--r--. 1 root root 10502 Dec? 3? 2013 ha.cf
-rw-r--r--. 1 root root? 5905 Dec? 3? 2013 haresources
-rw-r--r--. 1 root root? 2935 Dec? 3? 2013 README
?
copy 配置文件到、etc/ha.d
[root@centos6-1 heartbeat-3.0.4]# cp ha.cf haresources authkeys /etc/ha.d/
?heartbeat 配置文件:(主節點備節點配置相同)
[root@heartbeat1 ha.d]# grep -v ^# /etc/ha.d/authkeys
auth 3
3 md5 Hello!
[root@centos6-1 ha.d]# grep -v ^# /etc/ha.d/ha.cf
debugfile /var/log/ha-debug
logfile?/var/log/ha-log
logfacility?local0
keepalive 2
deadtime 5
warntime 10
initdead 60
udpport 694
mcast eth1 225.0.0.1 694 1 0
auto_failback on
node heartbeat1
node heartbeat2
[root@centos6-1 ha.d]# grep -v ^# /etc/ha.d/haresources
heartbeat1????? IPaddr::10.0.0.50/24/eth0 drbddisk::data Filesystem::/dev/drbd0::/md1::ext4
轉載于:https://blog.51cto.com/it1693/1680756
總結
以上是生活随笔為你收集整理的HeartBeat Install的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Laravel Query Builde
- 下一篇: SpringBoot2.0响应式编程系列