tfs的nameserver高可靠配置
接:http://1008305.blog.运维网.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附件,如下
附件:http://down.运维网.com/data/2360375
|