(1)分佈式原理
分佈式文件系統(isributedFileSystem)是指文件系統管理的物理存儲資源不必定直接鏈接在本地節點上,而是經過計算機網絡與節點相連。簡單來講,就是把一些分散的(分佈在局域網內各個計算機上)共享文件夾,集合到一個文件夾內(虛擬共享文件夾)。對於用戶來講,要訪問這些共享文件夾時,只要打開這個虛擬共享文件夾,就能夠看到全部連接到虛擬共享文件夾內的共享文件夾,用戶感受不到這些共享文件是分散於各個計算機上的。分佈式文件系統的好處是集中訪問、簡化操做、數據容災,以及提升文件的存取性能。
(2) MFS原理
MFS是一個具備容錯性的網絡分佈式文件系統,它把數據分散存放在多個物理服務器上,而呈現給用戶的則是一個統一的資源。vim
案例環境centos
角色 | 操做系統 | IP地址 |
---|---|---|
Master Server | centos 7 | 192.168.174.139 |
Metalogger | centos 7 | 192.168.174.140 |
Chunk1 | centos 7 | 192.168.174.141 |
Chunk2 | centos 7 | 192.168.174.142 |
Chunk3 | centos 7 | 192.168.174.165 |
Client | centos 7 | 192.168.174.168 |
一、下載源碼包及安裝準備瀏覽器
curl "https://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > /etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > /etc/yum.repos.d/MooseFS.repo
二、安裝mfsmaster安裝包服務器
yum install moosefs-master moosefs-cgi moosefs-cgiserv moosefs-cli -y
3.啓動mfsmaster服務,並查看服務是否開啓成功網絡
mfsmaster start //啓動服務 open files limit has been set to: 16384 working directory: /var/lib/mfs lockfile created and locked initializing mfsmaster modules ... exports file has been loaded topology file has been loaded loading metadata ... metadata file has been loaded no charts data file - initializing empty charts master <-> metaloggers module: listen on *:9419 master <-> chunkservers module: listen on *:9420 main master server module: listen on *:9421 mfsmaster daemon initialized properly
ps -ef | grep mfs mfs 38561 1 1 00:42 ? 00:00:00 mfsmaster start root 38563 3745 0 00:43 pts/0 00:00:00 grep --color=auto mfs
一、下載源碼包及安裝準備curl
curl "https://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > /etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > /etc/yum.repos.d/MooseFS.repo
二、安裝mfsmetalogger安裝包分佈式
yum -y install moosefs-metalogger
三、更改mfsmetalogger.cfg配置文件ide
vim /etc/mfs/mfsmetalogger.cfg MASTER_HOST = 192.168.174.139 //更改master_host主機地址,並去掉註釋
四、啓動服務,並查看服務是否開啓成功性能
mfsmetalogger start open files limit has been set to: 4096 working directory: /var/lib/mfs lockfile created and locked initializing mfsmetalogger modules ... mfsmetalogger daemon initialized properly
ps -ef | grep mfs mfs 71336 1 0 00:46 ? 00:00:00 mfsmetalogger start root 71338 45910 0 00:46 pts/1 00:00:00 grep --color=auto mfs
一、下載源碼包及安裝準備測試
url "https://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > /etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > /etc/yum.repos.d/MooseFS.repo
二、安裝chunkserver軟件包
yum -y install moosefs-chunkserver
三、修改mfschunkserver.cfg配置文件
vim /etc/mfs/mfschunkserver.cfg MASTER_HOST = 192.168.174.139
四、指定服務器分配給MFS使用的文件位置
vim /etc/mfs/mfshdd.cfg /data // 添加/data ,data是一個給MFS的分區,在生產環境中通常使用獨立的磁盤分區掛載到此目錄
四、建立/data目錄,並更改所主跟所屬信息
mkdir /data chown -R mfs.mfs /data
五、開啓服務並查看服務
mfschunkserver start open files limit has been set to: 16384 working directory: /var/lib/mfs lockfile created and locked setting glibc malloc arena max to 4 setting glibc malloc arena test to 4 initializing mfschunkserver modules ... hdd space manager: path to scan: /data/ hdd space manager: start background hdd scanning (searching for available chunks) main server module: listen on *:9422 no charts data file - initializing empty charts mfschunkserver daemon initialized properly [root@promote ~]#
ps -ef | grep mfs mfs 38952 1 2 01:07 ? 00:00:00 mfschunkserver start root 38962 3964 0 01:07 pts/0 00:00:00 grep --color=auto mfs
其餘兩臺chunk操做與這臺操做同樣,這邊就不一一演示了。
一、下載源碼包及安裝準備
curl "https://ppa.moosefs.com/RPM-GPG-KEY-MooseFS" > /etc/pki/rpm-gpg/RPM-GPG-KEY-MooseFS curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > /etc/yum.repos.d/MooseFS.repo
二、安裝moosefs客戶端
yum -y install moosefs-client
三、建立掛載目錄
mkdir -p /mfs/data
四、將掛載目錄掛載到master服務器上,並查看掛載
mfsmount /mfs/data -H 192.168.174.139 df -h //查看掛載
五、在Master Server上經過mfscgiserv命令開啓mfscgiserv服務
mfscgiserv lockfile created and locked starting simple cgi server (host: any , port: 9425 , rootpath: /usr/share/mfscgi)
六、在client客戶端瀏覽器測試,打開瀏覽器輸入192.168.174.139:9425查看監控的各類信息