web 監(jiān)控接口,提高隨機(jī)讀或?qū)懙男?,提高海量小文件的讀寫效率。但是mfs 把文件系統(tǒng)的結(jié)構(gòu)緩存到 master 的內(nèi)存中,文件越多,master
的內(nèi)存消耗越大,8g 對(duì)應(yīng) 2500w 的文件數(shù),2 億文件就得 64GB 內(nèi)存。支持特殊文件(塊和字符設(shè)備、管道以及套接字),符號(hào)連接和硬連接。
包括以下四種角色:
角色作用管理服務(wù)器 managing server (master)負(fù)責(zé)各個(gè)數(shù)據(jù)存儲(chǔ)服務(wù)器的管理,文件讀寫調(diào)度,文件空間回收以及恢復(fù).多節(jié)點(diǎn)拷貝元數(shù)據(jù)日志服務(wù)器 Metalogger server(Metalogger)負(fù)責(zé)備份 master 服務(wù)器的變化日志文件,文件類型為 changelog_ml.*.mfs,以便于在
master server 出問題的時(shí)候接替其進(jìn)行工作數(shù)據(jù)存儲(chǔ)服務(wù)器 data servers (chunk servers )聽從管理服務(wù)器調(diào)度,提供存儲(chǔ)空間,并為客戶提供數(shù)據(jù)傳輸.。
真正存儲(chǔ)用戶數(shù)據(jù)的服務(wù)器。存儲(chǔ)文件時(shí),首先把文件分成塊,然后這些塊在數(shù)據(jù)服務(wù)器 chunkserver之間復(fù) 制(復(fù)制份數(shù)可以手工指定,建議設(shè)置副本數(shù)為
3)。數(shù)據(jù)服務(wù)器可以是多個(gè),并且數(shù)量越多,可使用的“磁盤空間”越大,可靠性也越高??蛻魴C(jī)掛載使用 client computers掛載進(jìn)程 mfs 服務(wù)器共享出的存儲(chǔ)并使用。 通過 fuse
內(nèi)核接口掛載進(jìn)程管理服務(wù)器上所管理的數(shù)據(jù)存儲(chǔ)服務(wù)器共享出的硬盤。 共享的文件系統(tǒng)的用法和 nfs 相似。 使用 MFS 文件系統(tǒng)來存儲(chǔ)和訪問的主機(jī)稱為 MFS
的客戶端,成功掛接 MFS 文件系統(tǒng)以后,就可以像以前使用 NFS 一樣共享這個(gè)虛擬性的存儲(chǔ)了。
實(shí)驗(yàn)環(huán)境介紹
基本環(huán)境表
主機(jī)操作系統(tǒng)IP地址主要軟件Master ServerCentos7.3192.168.137.10moosefs.x86_64.0.3.0.101-1Metalogger ServerCentos7.3192.168.137.11moosefs.x86_64.0.3.0.101-1Chunk server1Centos7.3192.168.137.12moosefs.x86_64.0.3.0.101-1Chunk server2Centos7.3192.168.137.13moosefs.x86_64.0.3.0.101-1ClientCentos7.3192.168.137.14moosefs.x86_64.0.3.0.101-1
拓?fù)鋱D
操作步驟
五臺(tái)虛擬機(jī)模擬搭建MFS文件系統(tǒng)
關(guān)閉防火墻及selinux
systemctl stop firewalld
setenforce 0
搭建Master Server
安裝軟件
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
//添加適當(dāng)?shù)膸?kù)條目
yum install moosefs-master moosefs-cgi moosefs-cgiserv moosefs-cli
–y
配置文件解釋
cd /etc/mfs/
-rw-r–r–. 1 root root 4057 9月 27 15:18 mfsexports.cfg
//輸出目錄配置文件
-rw-r–r–. 1 root root 4057 7月 20 19:16
mfsexports.cfg.sample
-rw-r–r–. 1 root root 9015 9月 27 15:18
mfsmaster.cfg //Master配置文件
-rw-r–r–. 1 root root 9015 7月 20 19:16
mfsmaster.cfg.sample
-rw-r–r–. 1 root root 1052 9月 27 15:18
mfstopology.cfg //元數(shù)據(jù)日志
-rw-r–r–. 1 root root 1052 7月 20 19:16
mfstopology.cfg.sample
啟動(dòng)服務(wù)
systemctl start moosefs-master
systemctl enable moosefs-master
netstat
-ntap | grep mfstcp 0 0 0.0.0.0:9419 0.0.0.0:*
LISTEN 6217/mfsmaster
tcp 0 0 0.0.0.0:9420
0.0.0.0:* LISTEN 6217/mfsmaster
tcp 0 0
0.0.0.0:9421 0.0.0.0:* LISTEN 6217/mfsmaster
搭建MetalLogger Server
安裝
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
//添加適當(dāng)?shù)膸?kù)條目
yum install moosefs-metalogger –y
修改配置文件
vim /etc/mfs/mfsmetalogger.cfg
MASTER_HOST = 192.168.137.10
//第52行,去除注釋,改地址指向主服務(wù)器。
啟動(dòng)服務(wù)
systemctl start moosefs-metalogger
systemctl enable
moosefs-metalogger
netstat -ntap | grep mfstcp 0 0 192.168.137.11:36766 192.168.137.10:9419
ESTABLISHED 73521/mfsmetalogger
搭建Chunk Server
這兩臺(tái)Chunk Server的搭建步驟是完全相同
安裝
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
//添加適當(dāng)?shù)膸?kù)條目
yum install moosefs-chunkserver –y
修改配置文件
修改一
vim /etc/mfs/mfschunkserver.cfg
MASTER_HOST = 192.168.137.10 //第77行,將地址指向主服務(wù)器
修改二
vim /etc/mfs/mfshdd.cfg
/gongxiang
//在末行添加共享目錄mkdir /gongxiang //創(chuàng)建共享目錄
chown -R mfs:mfs /gongxiang //為共享目錄授權(quán)
啟動(dòng)服務(wù)
systemctl start moosefs-chunkserver
systemctl enable
moosefs-chunkserver
netstat -ntap | grep mfstcp 0 0 0.0.0.0:9422 0.0.0.0:*
LISTEN 71921/mfschunkserve
tcp 0 0 192.168.137.13:59006
192.168.137.10:9420 ESTABLISHED 71921/mfschunkserve
Client的搭建
安裝
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
//添加適當(dāng)?shù)膸?kù)條目
yum install moosefs-client –y
加載fuse模塊至內(nèi)核
modprobe fuse
掛載共享目錄
mkdir /opt/mfs //創(chuàng)建掛載點(diǎn)
mfsmount /opt/mfs/ -H 192.168.137.10
//掛載,地址為master地址df –h
文件系統(tǒng) 容量 已用 可用 已用% %u6302載點(diǎn)
/dev/sda6 21G 4.1G
17G 20% /
devtmpfs 896M 0 896M 0%
/dev
tmpfs 911M 0 911M 0%
/dev/shm
tmpfs 911M 11M 900M 2%
/run
tmpfs 911M 0 911M 0%
/sys/fs/cgroup
/dev/sda2 9.8G 33M 9.8G 1%
/opt
/dev/sda3 4.9G 89M 4.8G 2% /home
/dev/sda1
1014M 165M 850M 17% /boot
tmpfs 183M 64K 183M 1%
/run/user/1000
tmpfs 183M 0 183M 0%
/run/user/0
192.168.137.10:9421 58G 8.1G 50G 14%
/opt/mfs
MFS監(jiān)控
主服務(wù)器上開啟監(jiān)控
mfscgiserv
lockfile created and locked
starting simple cgi server
(host: any , port: 9425 , rootpath: /usr/share/mfscgi)
訪問192.168.137.10:9425 主機(jī)地址
填寫主服務(wù)器地址
界面
更多關(guān)于云服務(wù)器,域名注冊(cè),虛擬主機(jī)的問題,請(qǐng)?jiān)L問西部數(shù)碼官網(wǎng):m.ps-sw.cn