heartbeat安裝

這裏我就提供幾個主要軟件包了,其他的一些根據錯誤提示安裝或提前安裝完畢。

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) eth1:192.168.1.183(priv1)

node2(從服務器):eth0:192.168.1.181(node2) eth1: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/

[[email protected]]#./autogen.sh

[[email protected]]#./configure --prefix=/usr/local/ha/

[[email protected]]#make

[[email protected]]#make install


[[email protected]]#tar jxf /samba/Cluster-Resource-Agents-5ae70412eec8.tar.bz2 -C ./

[[email protected]]#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/

[[email protected]]# ./bootstrap

[[email protected]]#./configure --prefix=/usr/local/ha/

[[email protected]]#gmake

[[email protected]]#make install


[[email protected]]#chkconfig --add heartbeat


[[email protected]]#cp /usr/local/ha/share/doc/heartbeat/haresources /usr/local/ha/etc/ha.d/

[[email protected]]#cp /usr/local/ha/share/doc/heartbeat/authkeys /usr/local/ha/etc/ha.d/

[[email protected]]#cp /usr/local/ha/share/doc/heartbeat/ha.cf /usr/local/ha/etc/ha.d/

[[email protected]]#chmod 600 /usr/local/ha/etc/ha.d/authkeys

[[email protected]]#cd /usr/local/ha/etc/ha.d/

[[email protected]]#vi authkeys    //我選擇的是第一種驗證模式

181704408.jpg

[[email protected]]#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 eth1       //表示在eth1接口上使用以太網廣播方式

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


[[email protected]]#vi haresources

node1 IPaddr::192.168.1.185 httpd       //node1爲主節點主機名 ,IPaddr爲heartbeat自帶的一個執行腳本,192.168.1.185爲VIP地址,httpd表示啓動httpd服務


node1做完後繼續做node2,配置是一樣的,我就不重複說明了,都安裝配置完畢後再node1上ifconfig看看是否有VIP地址了

181727285.png

node1和node2都已經配置好了apache服務,現在用VIP地址訪問就可以訪問node1上的apache網站,node1如宕機了,node2會在指定的時候替代上去,那時訪問的就是node2上apache網站

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章