1. 程式人生 > >MFS分布式文件系統管理

MFS分布式文件系統管理

str 支持 metadata 備份 共享 restart cli 來講 並且

MFS官方網站http://www.moosefs.org/reference-guide.html

mooseFS(moose駝鹿)是一款網絡分布式文件系統,它把數據分散到多臺服務器上,但對於用戶來講,看到的只是一個源.MFS也像其他類unix文件系統,包含了層級結構(目錄樹),存儲著文件屬性(權限,最後訪問和修改時)可以創建特殊的文件(塊設備,字符設備,管道,套接字)符號鏈接.

技術分享

MooseFS文件系統介紹:

MooseFS是一中分布式文件系統,MooseFS文件系統結構包括一下四種角色:

1.管理服務器master

管理服務器:負責各個數據存儲服務的管理文件讀寫調度,文件空間回收以及恢復,多節點拷貝

2.元數據日誌服務器:負責備份master服務器的變化日誌文件,文件類型為changelog_ml.*.mfs,以便於在master server出現問題的時候解體器 進行工作

3.數據存儲服務器data server(chunk servers)

真正存儲用戶數據的服務器 ,存儲文件時,首先把文件分成塊,然後這些塊在數據服務器chunkserver之間賦值(復制份數可以手工指定,建議設置副本數為數據服務器可以為多個,並且數據越多,可使用的“磁盤空間越大,”可靠性也越高 .

4.客戶端掛在 使用clinet computers

使用MFS文件系統來存儲和訪問的主機名稱為MFS的客戶端,成功掛載MFS系統以後,就可以像以前NFS一樣共享這個虛擬性的存儲了。

技術分享

實驗環境:

服務器:

masters:192.168.20.138

chunk-server:192.168.20.150

Metalogger-server192.168.20.163

客戶端掛載使用(clinet computers):192.168.20.163

---------------------------------------------------------------------------------------------

實驗環境準備:

fuse.ko

所有服務器端和客戶端都要支持 fuse內核模塊。

由於MFS的客戶端程序也就是jiazaimfs磁盤系統的命令是使用了fuse.

用戶空間文件系統(簡稱FUSE)是操作系統中的概念,指完全在用戶狀態實現的文件系統,目前linux通過內核模塊對此進行支持,一些文件系統如NTFS-3G(作用:讓linux中對NTFS文件系統提供支持)使用FUSE實現.

2.6以上內核,都自帶fuse

一.Master

[[email protected] ~]# yum install gcc fuse fuse-devel zlib-devel –y

[[email protected] ~]# useradd -M -s /sbin/nologin mfs

[[email protected] ~]# tar zxvf mfs-1.6.27-5.tar.gz -C /usr/src/

[[email protected] ~]# cd /usr/src/mfs-1.6.27/

[[email protected] mfs-1.6.27]# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmount

[email protected] mfs-1.6.27]# make

[email protected] mfs-1.6.27]# make install

[[email protected] mfs]# cp mfsexports.cfg.dist mfsexports.cfg

[[email protected] mfs]# cp mfsmaster.cfg.dist mfsmaster.cfg

[[email protected] mfs]# cp mfstopology.cfg.dist mfstopology.cfg

[[email protected] mfs]# cd /usr/local/mfs/var/mfs

[[email protected] mfs]# ls

metadata.mfs.empty

[[email protected] mfs]# cp metadata.mfs.empty metadata.mfs

[[email protected] mfs]# cat /usr/local/mfs/etc/mfs/mfsexports.cfg

[[email protected] mfs]# cat /usr/local/mfs/etc/mfs/mfsmaster.cfg

[A1] [[email protected] mfs]# /usr/local/mfs/sbin/mfsmaster restart[A2]

[[email protected] mfs]# netstat -anput | grep mfs

tcp 0 0 0.0.0.0:9419 0.0.0.0:* LISTEN 10761/mfsmaster

tcp 0 0 0.0.0.0:9420 0.0.0.0:* LISTEN 10761/mfsmaster

tcp 0 0 0.0.0.0:9421 0.0.0.0:* LISTEN 10761/mfsmaster


[A1]簡單查看文件的配置,暫不做修改

[A2]啟動MFS

二.安裝MataLogger(元數據日誌服務器)

[[email protected] ~]# yum install gcc fuse fuse-devel zlib-devel –y

[[email protected] ~]# useradd -M -s /sbin/nologin mfs

[[email protected] ~]# tar zxvf mfs-1.6.27-5.tar.gz -C /usr/src/

[[email protected] mfs-1.6.27]# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver --disable-mfsmoumnt

[[email protected] mfs-1.6.27]# make

[[email protected] mfs-1.6.27]# make install

[[email protected] mfs-1.6.27]# cd /usr/local/mfs/etc/mfs

[[email protected] mfs]# cp mfsmetalogger.cfg.dist mfsmetalogger.cfg

[[email protected] mfs]# vim /usr/local/mfs/etc/mfs/mfsmetalogger.cfg

技術分享

[[email protected] mfs]# /usr/local/mfs/sbin/mfsmetalogger restart

[[email protected] mfs]# ps -elf | grep mfs

5 S mfs 36452 1 0 61 -19 - 2764 poll_s 11:06 ? 00:00:00 /usr/local/mfs/sbin/mfsmetalogger restart

0 S root 36459 3535 0 80 0 - 25814 pipe_w 11:08 pts/1 00:00:00 grep mfs

三.Chunk-server(數據存儲服務器)

[[email protected] ~]# yum install gcc fuse fuse-devel zlib-devel –y

[[email protected] ~]# useradd -M -s /sbin/nologin mfs

[[email protected] ~]# tar zxvf mfs-1.6.27-5.tar.gz -C /usr/src/

[[email protected] ~]# cd /usr/src/mfs-1.6.27/

[[email protected] mfs-1.6.27]# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster --disable-mfsmount

[[email protected] mfs-1.6.27]# make

[[email protected] mfs-1.6.27]# make install

[[email protected] mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/

[[email protected] mfs]# cp mfschunkserver.cfg.dist mfschunkserver.cfg

[[email protected] mfs]# cp mfshdd.cfg.dist mfshdd.cfg

[[email protected] mfs]# vim /usr/local/mfs/etc/mfs/mfschunkserver.cfg

[email protected] mfs]# cp mfschunkserver.cfg.dist mfschunkserver.cfg

[[email protected] mfs]# vim /usr/local/mfs/etc/mfs/mfschunkserver.cfg

技術分享

[[email protected] mfs]# vim /usr/local/mfs/etc/mfs/mfshdd.cfg

技術分享

技術分享

[email protected] ~]# mkdir /data

[[email protected] ~]# chown -R mfs:mfs /data/

[[email protected] ~]# /usr/local/mfs/sbin/mfschunkserver restart

[[email protected] ~]# ps -elf | grep mfs

5 S mfs 25099 1 2 61 -19 - 42704 poll_s 21:44 ? 00:00:01 /usr/local/mfs/sbin/mfschunkserver restart

0 S root 25125 20503 0 80 0 - 25805 pipe_w 21:45 pts/1 00:00:00 grep mfs

[[email protected] ~]# netstat -anput | grep mfs

tcp 0 0 0.0.0.0:9422 0.0.0.0:* LISTEN 25099/mfschunkserve

四:客戶部署與配置

yum install gcc fuse fuse-devel zlib-devel –y

[[email protected] ~]# tar zxvf fuse-2.9.2.tar.gz -C /usr/src/

[[email protected] ~]# cd /usr/src/fuse-2.9.2/

[[email protected] fuse-2.9.2]# ./configure

[[email protected] fuse-2.9.2]# make && makek install

[[email protected] fuse-2.9.2]# vim /etc/profile

技術分享

[email protected] fuse-2.9.2]# . /etc/profile

[[email protected] fuse-2.9.2]# source /etc/profile

[[email protected] ~]# useradd -M -s /sbin/nologin mfs

[[email protected] ~]# tar zxvf mfs-1.6.27-5.tar.gz -C /usr/src/

[email protected] ~]# cd /usr/src/mfs-1.6.27/

[email protected] mfs-1.6.27]# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --disable-mfsmaster --disable-mfschunkserver --enable-mfsmount

如果還是有問題的,解決方法:yum -y install fuse-devel

[email protected] mfs-1.6.27]# make && make install

[[email protected] mfs-1.6.27]# cd

[[email protected] ~]# modprobe fuse

[[email protected] ~]# mkdir /xiaoyu

[[email protected] ~]# /usr/local/mfs/bin/mfsmount /xiaoyu/ -H 192.168.20.138

mfsmaster accepted connection with parameters: read-write,restricted_ip ; root mapped to root:root

[[email protected] ~]# mount

技術分享

[[email protected] ~]# df –Th

技術分享

[email protected] ~]# vim /etc/profile

export PATH=/usr/local/mfs/bin$PATH

[[email protected] ~]# source /etc/profile

[[email protected] ~]# ln -s /usr/local/mfs/bin/* /usr/local/bin/

[[email protected] ~]# mfsgetgoal -r /xiaoyu/

[email protected] ~]# mfsgetgoal -r /xiaoyu/

/xiaoyu/:

directories with goal 1 : 1

[[email protected] ~]# mfsgetgoal -r 3 /xiaoyu/

3: realpath error on (/root/3): ENOENT (No such file or directory)

/xiaoyu/:

directories with goal 1 :

MFS分布式文件系統管理