High-Availability

回覆文章
schumi
Site Admin
文章: 696
註冊時間: 2004-04-15 14:30:34

Linux HA

文章 schumi »

from http://phorum.study-area.org/viewtopic. ... 3%C6%B4%A9

urpmi heartbeat
urpmi heartbeat-pils
urpmi heartbeat-stonith

編輯設定檔
vi /etc/ha.d/ha.cf
啟用下面參數
debugfile /var/log/ha-debug
logfile /var/log/ha-log
keepalive 30
deadtime 300
bcast eth1 #設定使用Crossover那張網路介面用於ha互相偵測
node server1 #主機1
node server2 #主機2

編輯資源設定檔
vi /etc/ha.d/haresources
加入下面參數
被備援的主機名稱 IPaddr::10.1.1.10 httpd #設定10.1.1.10為以後對外服務IP

編輯驗證設定檔
vi /etc/ha.d/authkeys
啟用下面參數(auth 1 要disable)
auth 2
1 crc
2 sha1 testpasswd #testpasswd為群組認定為同一cluster的識別密碼需相同
3 md5 Hello!

]#chmod 600 /etc/ha.d/authkeys

啟動heartbeat服務 (先啟動active後啟動passive)
]# /etc/rc.d/init.d/heartbeat start

-------------------------------------------------------------------------------------
確認浮動IP已經掛載在主伺服器上
eth1:0 Link encap:Ethernet HWaddr 00:50:BA:EA:BC:78
inet addr:192.168.100.111 Bcast:192.168.100.255 Mask:255.255.255.0
確認httpd服務已啟動
[root@first ~]# ps aux |grep httpd
root 7077 1.7 4.8 26776 12388 ? Ss 22:45 0:01 /usr/sbin/httpd

5.使用ipfail避免網路錯誤
]#vi /etc/ha.d/ha.cf
啟用下面參數
ping 192.168.100.254 這裡最好設定偵測不易停擺的設備如:router
respawn hacluster /usr/lib/heartbeat/ipfail
最後由 schumi 於 2005-06-01 16:46:38 編輯,總共編輯了 5 次。
yehlu
Site Admin
文章: 3244
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

手動停機/復機程序

文章 yehlu »

AP1 主要機
AP2 備援機

HA服務重開的順序
/etc/rc.d/init.d/heartbeat stop -----停止HA作動
/etc/rc.d/init.d/network restart ----重新啟動網卡來釋放HA所bind的網卡
/etc/rc.d/init.d/heartbeat start -----兩台server一起啟動HA

停機

1.AP1 先停 apache
ap1/etc/rc.d/init.d/httpd stop

2.AP2 拷貝 AP1 的session
ap2/root/update_sess

3.停掉AP1

復機

1.停掉 AP2 的 apache
ap2/etc/rc.d/init.d/httpd stop

2.AP1 拷貝AP2 的session
ap1/root/update_sess

3.重新啟動 AP2 的 ha
ap2/etc/rc.d/init.d/heartbeat restart

4.重起 AP2 的 apache
ap2/etc/rc.d/init.d/httpd start
回覆文章

回到「Linux」