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附件,如下 

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