构建高可用MFS分布式文件存储架构(6)

五.网页监控--mfscgiserv

mfscgiserv是用python编写的一个web服务工具,它的监听端口是9425,可以利用:/usr/local/mfs/sbin/mfscgiserv来启动,用户利用浏览器就可全面监控所有客户挂接,chunkserver及master server,客户端的各种操作等等,绝对是个好工具。通过浏览器可以查看::9425

 

六.MFS客户端常用命令介绍

[root@mfs-client mfs]# ll /usr/local/mfs/bin/

total 556

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsappendchunks -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfscheckfile -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsdeleattr -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsdirinfo -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsfileinfo -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsfilerepair -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsgeteattr -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsgetgoal -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsgettrashtime -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsmakesnapshot -> mfstools

-rwxr-xr-x 1 root root 384447 Jun  5 01:09 mfsmount

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsrgetgoal -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsrgettrashtime -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsrsetgoal -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsrsettrashtime -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfsseteattr -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfssetgoal -> mfstools

lrwxrwxrwx 1 root root      8 Jun  5 01:09 mfssettrashtime -> mfstools

-rwxr-xr-x 1 root root    137 Jun  5 01:09 mfssnapshot

-rwxr-xr-x 1 root root 170799 Jun  5 01:09 mfstools

 

七.整个系统架构总结

 

1.heartbeat与drbd的集成

DRBD的主从的切换依赖与heartbeat的服务,所以集成的关键点在于定义Initdrbd的脚本文件的定义和heartbeat的服务定义文件/etc/ha.d/resource.d。如mfs-master Initdrbd 就是集成DRBD和heartbeat。

 

2.heartbeat与MFS的集成

与DRBD一样,mfsmaster的脚本文件定义与heartbeat的服务定义文件/etc/ha.d/resource.d中即可。

 

3.drbd 与mfs 的集成

在主服务器中,必须把MFS的安装文件全部安装到drbd的挂载目录中去,安装到块设备上去,所以在主从切换的时候,备份机器拿到安装环境和主的一样,那么通过同样的方式来启动MFS进程,达到切换切换启动MFS的目的。

 

 

八.测试

1.两台server上启动DRBD,利用cat /proc/drbd 查看启动情况和网络状态

主机器上显示Primary/Secondary 备份机器上显示Secondary/Primary,启动成功

主上查看:

[root@mfs-master /]# cat /proc/drbd 

version: 8.3.13 (api:88/proto:86-96)

GIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by mockbuild@builder10.CentOS.org, 2012-05-07 11:56:36

 

 1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----

    ns:2377 nr:41 dw:2418 dr:694 al:4 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

 

备上查看:

[root@mfs-bak ha.d]# cat /proc/drbd

version: 8.3.13 (api:88/proto:86-96)

GIT-hash: 83ca112086600faacab2f157bc5a9324f7bd7f77 build by mockbuild@builder10.centos.org, 2012-05-07 11:56:36

 

 1: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----

    ns:41 nr:2377 dw:2379 dr:173 al:1 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0

结论:说明主备上DRBD启动正常,之前连接正常!

 

2.启动heartbeat,通过日志查看heartbeat包括关联的服务加载的情况,tail -f /var/log/ha.log

 

[root@mfs-master /]# tail -f /var/log/ha.log 

IPaddr[15336]:2012/06/05_19:26:04 INFO:  Resource is stopped

ResourceManager[15238]:2012/06/05_19:26:04 info: Running /etc/ha.d/resource.d/IPaddr 192.168.8.210 start

IPaddr[15409]:2012/06/05_19:26:04 INFO: Using calculated nic for 192.168.8.210: eth0

IPaddr[15409]:2012/06/05_19:26:04 INFO: Using calculated netmask for 192.168.8.210: 255.255.255.0

IPaddr[15409]:2012/06/05_19:26:04 INFO: eval ifconfig eth0:0 192.168.8.210 netmask 255.255.255.0 broadcast 192.168.8.255

IPaddr[15392]:2012/06/05_19:26:04 INFO:  Success

heartbeat[15225]: 2012/06/05_19:26:04 info: local HA resource acquisition completed (standby).

heartbeat[15197]: 2012/06/05_19:26:04 info: Standby resource acquisition done [foreign].

heartbeat[15197]: 2012/06/05_19:26:04 info: Initial resource acquisition complete (auto_failback)

heartbeat[15197]: 2012/06/05_19:26:05 info: remote resource transition completed.

 

结论:heartbeat 启动成功!

 

3.在主机器上ps的方式查看heartbeat 和MFS进程,确保服务启动,如果没有启动,可手动在启动一次。此时备份机器的mfs没有启动。

[root@mfs-master /]# ps aux |grep haert

root     15507  0.0  0.2  61220   748 pts/0    S+   19:30   0:00 grep haert

[root@mfs-master /]# ps aux |grep heart

root     15197  0.0  4.4  58008 13008 ?        SLs  19:25   0:00 heartbeat: master control process

nobody   15200  0.0  2.1  51412  6412 ?        SL   19:25   0:00 heartbeat: FIFO reader        

nobody   15201  0.0  2.1  51408  6408 ?        SL   19:25   0:00 heartbeat: write: bcast eth1  

nobody   15202  0.0  2.1  51408  6408 ?        SL   19:25   0:00 heartbeat: read: bcast eth1   

root     15509  0.0  0.2  61220   744 pts/0    S+   19:30   0:00 grep heart

[root@mfs-master /]# ps aux |grep mfs

root     14914  0.0  3.5 136048 10416 ?        S    19:18   0:00 python /data/mfs/sbin/mfscgiserv

mfs      15320  0.8 27.3  93880 80508 ?        S<   19:25   0:02 /usr/local/mfs/sbin/mfsmaster start

root     15511  0.0  0.2  61220   744 pts/0    S+   19:30   0:00 grep mfs

 

结论:主服务器上各服务正常启动

 

4.停止主服务的heartbeat,查看主服务的日志,发现所有的关联服务都会被关闭,包括drbd,mfs,vip等。

[root@mfs-master mfs]# service heartbeat stop

Stopping High-Availability services: 

                                                           [  OK  ]

[root@mfs-master mfs]# tail -f /var/log/ha.log 

ResourceManager[14246]:2012/06/05_19:06:57 info: Running /etc/ha.d/resource.d/mfsmaster  stop

ResourceManager[14246]:2012/06/05_19:06:57 info: Running /etc/ha.d/resource.d/Initdrbd  stop

heartbeat[14233]: 2012/06/05_19:06:58 info: All HA resources relinquished.

heartbeat[8527]: 2012/06/05_19:07:00 info: killing HBFIFO process 8529 with signal 15

heartbeat[8527]: 2012/06/05_19:07:00 info: killing HBWRITE process 8530 with signal 15

heartbeat[8527]: 2012/06/05_19:07:00 info: killing HBREAD process 8531 with signal 15

heartbeat[8527]: 2012/06/05_19:07:00 info: Core process 8530 exited. 3 remaining

heartbeat[8527]: 2012/06/05_19:07:00 info: Core process 8531 exited. 2 remaining

heartbeat[8527]: 2012/06/05_19:07:00 info: Core process 8529 exited. 1 remaining

heartbeat[8527]: 2012/06/05_19:07:00 info: mfs-master Heartbeat shutdown complete.

 

结论:可以看到各关联服务正关闭!

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/fb3614ca9886bf8022b4343f8c0dfe07.html