tfs的nameserver高可靠配置
接:http://1008305.blog.51cto.com/998305/768258
配置TFS的高可靠nameserver
配置前對Web1的配置
在/etc/hosts文件下添加
10.0.0.200 web1
10.0.0.100 web2
配置前對Web2的配置
在/etc/hosts文件下添加
10.0.0.200 web1
10.0.0.100 web2
分別在web1、 web2上安裝heartbeat…直接用yum來安裝。
一、文件配置
在web1上配置heartbeat
Ha.cf文件配置:
debugfile /var/log/ha-debug
debug 1
keepalive 2
warntime 5
deadtime 10
initdead 30
auto_failback on
autojoin none
ucast eth1 10.0.0.100
udpport 694
node web1
node web2
compression bz2
logfile /var/log/ha-log
logfacility local0
crm on
authkeys文件配置:
auth 1
1 md5 Hello!
haresources文件配置:
web1 192.168.2.11 NameServer
在web2上配置heartbeat
Ha.cf文件配置:
debugfile /var/log/ha-debug
debug 1
keepalive 2
warntime 5
deadtime 10
initdead 30
auto_failback on
autojoin none
ucast eth1 10.0.0.200
udpport 694
node web1
node web2
compression bz2
logfile /var/log/ha-log
logfacility local0
crm on
authkeys文件配置:
auth 1
1 md5 Hello!
haresources文件配置:
web2 192.168.2.11 NameServer
在淘寶tfs安裝目錄scripts/ha下有個NameServer和ns.xml文件,把兩個配置文件稍微改下,分別複製到/etc/rc.d/init.d和/var/lib/heartbeat/crm下,並把nx.xml改名爲cib.xml(淘寶是把NameServer複製到/usr/lib/ocf/resource.d/heartbeat/下…但這樣資源監控不了)
在web1、web2都執行
cd /var/lib/heartbeat/crm
chown hacluster:haclient cib.xml
可通過crm_verify -x cib.xml來檢查配置文件是否正確
然後啓動heartbeat
Service heartbeat start
二、查看日誌
查看web2的日誌
查看到web1的日誌
在web1上看到VIP已經起來,而且nameserver也啓動
在/var/lib/heartbeat/crm目錄下生成相應的文件
三、故障切換
在web1上停止nameserver
Crm會監控到nameserver已停止並會去啓動
在web1上把heartbeat 停止進行測試
在web2上查看日誌
可以看到VIP被web2接管
Tfs的高可靠ha就這樣完成了
web1 的cib.xml web2的cib.xml 及NameServer附件,如下