I combine the online tutorial, I slowly learn to write, write very simple, do not spray!
Environment:
System: Centos6.8 (2.6.32-642.el6.x86_x64)
Software: heartbeat-3.0.4-2.el6.x86_x64
Topology:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/89/F1/wKiom1gh6m3S1w2aAADUTJkOk_M990.png-wh_500x0-wm_3 -wmp_4-s_2580565274.png "title=" Wxid_vgg577302yyt12_1478604618202_23.png "alt=" Wkiom1gh6m3s1w2aaadutjkok_ M990.png-wh_50 "/>
First: Turn off firewall time synchronization and so on, you can see the previous article.
HA01 Configuration
Modify hostname,
# hostname HA01 (the name can be casual, but not the number)
# echo ' 192.168.20.1 ha01 ' >>/etc/hosts (parsing)
#echo '/sbin/route add-host 192.168.30.2 dev eth2 ' >>/etc/rc.local (Heartbeat routing trend)
#route-N (see if correct)
After the modification, if it does not take effect can be restarted, ping 192.168.20.1 can get ha01 return value on the line.
The following Yum has been installed.
CentOS may not have a heartbeat Yum installation source and need to install epel-release.
# yum Install Epel-release-y
# yum Install heartbeat*-y
After the installation, all the documents are under/usr/share/doc/heartbeat-3.0.4, the main files are:
HA.CF Basic Configuration file
Authkeys Key Configuration
Haresources IP Address and script configuration file
After the first two configurations are almost unchanged, haresources may change frequently because the nodes are incremented in this file.
Copy three files to the/etc/ha.d/directory, but many of the online is handwritten a simple, so no copy, but handwritten three configuration files.
# cd/etc/ha.d/
This directory was originally HARC RC.D Readme.config resource.d Shellfuncs
###################################################################################
# Vim HA.CF
#by http://sadoc.blog.51cto.com/
#date 2016-11-08 20:00
Debugfile/var/log/ha-debug
#debug日志文件
LogFile/var/log/ha-log
#启动信息文件
LogfacilityLocal1
#启动级别
KeepAlive 2
Deadtime 30
Warntime 10
Initdead 120
Mcast eth2 225.0.0.1 694 1 0
#多播方式, the eth2 NIC, 225.0.0. 1. The last 1 can be casually, port 694
Auto_failback on
#自动接管服务器
Nodeha01
Nodeha02
CRMNo
######################################################################################
#vim Authkeys
Auth 1
1 SHA1 47e9336850f1db6fa58bc470bc9b7810eb397f04
Authkeys requires 600 permissions
#chmod 600/etc/ha.d/authkeys
#######################################################################################
#vim haresources
#by http://sadoc.blog.51cto.com/
#date 2016-11-08 20:00
HA01 Ipaddr::192.168.40.1/24/eth0
#########################################################################################
The HA02 server configuration is almost constant:
(just modify the following two points)
#hostname HA02
#echo '/sbin/route add-host 192.168.30.1 dev eth2 ' >>/etc/rc.local (Heartbeat routing trend)
##########################################################
#启动服务:
/etc/init.d/heartbeat start
Prompt two lines, last line tip: Done
Then enter:
Ha01#ip A
You can see that there are two IP on the eth0, if the virtual machine has automatic acquisition, and the network will have three addresses.
###########################################################
Then simulate the down machine to see if it can take over.
Stop HA01
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/89/F0/wKioL1gijLqBexuYAADQSMaMzqY775.png-wh_500x0-wm_3 -wmp_4-s_3947142648.png "title=" 01.png "alt=" Wkiol1gijlqbexuyaadqsmamzqy775.png-wh_50 "/>
HA02 View
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/89/F0/wKioL1gijNSD7rxrAADBNuzKh8g500.png-wh_500x0-wm_3 -wmp_4-s_1442738346.png "title=" 02.png "alt=" Wkiol1gijnsd7rxraadbnuzkh8g500.png-wh_50 "/>
Enable HA01
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/89/F3/wKiom1gijVShUs9VAAFyoYANh_4983.png-wh_500x0-wm_3 -wmp_4-s_2531565203.png "title=" Qq20161109104309.png "alt=" Wkiom1gijvshus9vaafyoyanh_4983.png-wh_50 "/>
###########################################################
At present: Next time, if there are omissions or errors, I hope to correct.
CenTos6.8 Installation Heartbeat