Heartbeat的CRM監控淘寶tfs的nameserver配置

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下有個NameServerns.xml文件,把兩個配置文件稍微改下,分別複製到/etc/rc.d/init.d/var/lib/heartbeat/crm,並把nx.xml改名爲cib.xml(淘寶是把NameServer複製到/usr/lib/ocf/resource.d/heartbeat/但這樣資源監控不了)

 

web1web2都執行

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上查看日誌 

 

可以看到VIPweb2接管 

 

Tfs的高可靠ha就這樣完成了

web1 的cib.xml  web2的cib.xml 及NameServer附件,如下 

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