Moosefs 分布式存储.docx
《Moosefs 分布式存储.docx》由会员分享,可在线阅读,更多相关《Moosefs 分布式存储.docx(18页珍藏版)》请在冰豆网上搜索。
![Moosefs 分布式存储.docx](https://file1.bdocx.com/fileroot1/2023-1/26/8c6c3ca4-963e-41d3-a69d-f040a5e4650d/8c6c3ca4-963e-41d3-a69d-f040a5e4650d1.gif)
Moosefs分布式存储
===========Moosefs分布式存储=========
[root@server41~]#lftpi#远程访问服务器,获取mfs安装包
lftpi:
~>cdpub/docs/mfs/
lftpi:
/pub/docs/mfs>getmfs-1.6.27-1.tar.gz
[root@server41~]#rpm-ivhmfs-1.6.27-1.tar.gz
error:
mfs-1.6.27-1.tar.gz:
notanrpmpackage(orpackagemanifest):
错误:
显示是软件包的名称中有的-1不识别,需要修改软件包名称
[root@server41~]#mvmfs-1.6.27-1.tar.gzmfs-1.6.27.tar.gz
[root@server41~]#rpmbuild-tbmfs-1.6.27.tar.gz
error:
Failedbuilddependencies:
fuse-develisneededbymfs-1.6.27-2.x86_64
错误:
需要安装fuse-devel依赖性
[root@server41~]#yuminstall-yfuse-devel
[root@server41~]#rpmbuild-tbmfs-1.6.27.tar.gz
[root@server41~]#cd/root/rpmbuild/RPMS/x86_64/
[root@server41x86_64]#rpm-ivhmfs-master-1.6.27-2.x86_64.rpm
[root@server41x86_64]#rpm-ivhmfs-cgi-1.6.27-2.x86_64.rpm
[root@server41x86_64]#rpm-ivhmfs-cgiserv-1.6.27-2.x86_64.rpm
[root@server41x86_64]#cd/etc/mfs/
[root@server41mfs]#cpmfsmaster.cfg.distmfsmaster.cfg
[root@server41mfs]#cpmfsexports.cfg.distmfsexports.cfg
[root@server41mfs]#cpmfstopology.cfg.distmfstopology.cfg
[root@server41mfs]#cd/var/lib/mfs/
[root@server41mfs]#cpmetadata.mfs.emptymetadata.mfs
[root@server41mfs]#chownnobody/var/lib/mfs/-R
[root@server41mfs]#mfsmaster
[root@server41mfs]#cd/var/lib/mfs/
[root@server41mfs]#ls
metadata.mfs.backmetadata.mfs.emptysessions.mfs
[root@server41mfs]#mfsmasterstop
[root@server41mfs]#ls
metadata.mfsmetadata.mfs.back.1metadata.mfs.emptysessions.mfsstats.mfs
[root@server41mfs]#mfsmaster
[root@server41mfs]#ls
metadata.mfs.backmetadata.mfs.emptystats.mfs
metadata.mfs.back.1sessions.mfs
[root@server41mfs]#cd/usr/share/mfscgi/
[root@server41mfscgi]#chmod+xchart.cgimfs.cgi
[root@server41mfscgi]#mfscgiserv
测试:
浏览器访问http:
//192.168.2.41:
9425/mfs.cgi,界面显示如下:
[root@server41~]#cdrpmbuild//RPMS/x86_64/
[root@server41x86_64]#scpmfs-chunkserver-1.6.27-2.x86_64.rpm192.168.2.42:
[root@server42mfs]#vim/etc/hosts
192.168.2.42mfsmaster
[root@server42mfs]#fdisk-l
[root@server42mfs]#fdisk-cu/dev/vdc
Command(mforhelp):
n
Commandaction
eextended
pprimarypartition(1-4)
p
Partitionnumber(1-4):
1
Firstsector(2048-16777215,default2048):
Usingdefaultvalue2048
Lastsector,+sectorsor+size{K,M,G}(2048-16777215,default16777215):
Usingdefaultvalue16777215
Command(mforhelp):
t
Selectedpartition1
Hexcode(typeLtolistcodes):
8e
Changedsystemtypeofpartition1to8e(LinuxLVM)
Command(mforhelp):
p
Disk/dev/vdc:
8589MB,8589934592bytes
2heads,1sectors/track,8388608cylinders,total16777216sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):
512bytes/512bytes
I/Osize(minimum/optimal):
512bytes/512bytes
Diskidentifier:
0xb2f86748
DeviceBootStartEndBlocksIdSystem
/dev/vdc11025838860883875848eLinuxLVM
Command(mforhelp):
w
Thepartitiontablehasbeenaltered!
Callingioctl()tore-readpartitiontable.
Syncingdisks.
[root@server42mfs]#pvcreate/dev/vdc1
[root@server42mfs]#vgcreatemfsvg/dev/vdc1
[root@server42mfs]#lvcreate-L4g-ndemomfsvg
[root@server42mfs]#mkfs.ext4/dev/mfsvg/demo
[root@server42mfs]#mkdir/mnt/chunk1
[root@server42mfs]#mount/dev/mfsvg/demo/mnt/chunk1/
[root@server42mfs]#vim/etc/fstab
/dev/mfsvg/demo/mnt/chunk1ext4defaults00
[root@server42mfs]#mount-a
[root@server42mfs]#df-h
FilesystemSizeUsedAvailUse%Mountedon
/dev/mapper/VolGroup-lv_root4.9G1.1G3.6G23%/
tmpfs246M0246M0%/dev/shm
/dev/vda1485M33M427M8%/boot
/dev/mapper/mfsvg-demo4.0G136M3.7G4%/mnt/chunk1
[root@server42mfs]#vimmfshdd.cfg
/mnt/chunk1
[root@server42mfs]#chown-Rnobody.nobody/mnt/chunk1/
[root@server42mfs]#mkdir/var/lib/mfs
[root@server42mfs]#chown-Rnobody/var/lib/mfs/
[root@server42mfs]#mfschunkserver
[root@server42mfs]#cd/var/lib/mfs/
[root@server42mfs]#l.
....mfschunkserver.lock
[root@server42~]#lvextend-l+1023/dev/mfsvg/demo
[root@server42~]#resize2fs/dev/mfsvg/demo
[root@server42~]#df-h
FilesystemSizeUsedAvailUse%Mountedon
/dev/mapper/VolGroup-lv_root4.9G1.1G3.6G23%/
tmpfs246M0246M0%/dev/shm
/dev/vda1485M33M427M8%/boot
/dev/mapper/mfsvg-demo7.9G138M7.4G2%/mnt/chunk1
[root@server42~]#scpmfs-chunkserver-1.6.27-2.x86_64.rpm192.168.2.43:
[root@server43~]#rpm-ivhmfs-chunkserver-1.6.27-2.x86_64.rpm
[root@server43mfs]#cpmfschunkserver.cfg.distmfschunkserver.cfg
[root@server43mfs]#cpmfshdd.cfg.distmfshdd.cfg
[root@server43~]#vim/etc/hosts
192.168.2.41mfsmastsr
192.168.2.43
[root@server43~]#fdisk-l
[root@server43~]#fdisk-cu/dev/vdb
Command(mforhelp):
p
Disk/dev/vdb:
8589MB,8589934592bytes
2heads,1sectors/track,8388608cylinders,total16777216sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):
512bytes/512bytes
I/Osize(minimum/optimal):
512bytes/512bytes
Diskidentifier:
0x28340149
DeviceBootStartEndBlocksIdSystem
/dev/vdb120481677721583875848eLinuxLVM
Command(mforhelp):
d
Selectedpartition1
Command(mforhelp):
p
Disk/dev/vdb:
8589MB,8589934592bytes
2heads,1sectors/track,8388608cylinders,total16777216sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):
512bytes/512bytes
I/Osize(minimum/optimal):
512bytes/512bytes
Diskidentifier:
0x28340149
DeviceBootStartEndBlocksIdSystem
Command(mforhelp):
n
Commandaction
eextended
pprimarypartition(1-4)
p
Partitionnumber(1-4):
1
Firstsector(2048-16777215,default2048):
Usingdefaultvalue2048
Lastsector,+sectorsor+size{K,M,G}(2048-16777215,default16777215):
Usingdefaultvalue16777215
Command(mforhelp):
t
Selectedpartition1
Hexcode(typeLtolistcodes):
8e
Changedsystemtypeofpartition1to8e(LinuxLVM)
Command(mforhelp):
p
Disk/dev/vdb:
8589MB,8589934592bytes
2heads,1sectors/track,8388608cylinders,total16777216sectors
Units=sectorsof1*512=512bytes
Sectorsize(logical/physical):
512bytes/512bytes
I/Osize(minimum/optimal):
512bytes/512bytes
Diskidentifier:
0x28340149
DeviceBootStartEndBlocksIdSystem
/dev/vdb120481677721583875848eLinuxLVM
Command(mforhelp):
w
Thepartitiontablehasbeenaltered!
Callingioctl()tore-readpartitiontable.
[root@server43~]#pvcreate/dev/vdb1
[root@server43~]#vgcreatemfsvg/dev/vdb1
[root@server43~]#lvcreate-l2047-ndemomfsvg
[root@server43~]#mkfs.ext4/dev/mfsvg/demo
[root@server43~]#mkdir/mnt/chunk1
[root@server43mfs]#vimmfshdd.cfg
/mnt/chunk1
[root@server43mfs]#chown-Rnobody.nobody/mnt/chunk1/
[root@server43mfs]#mkdir/var/lib/mfs
[root@server43mfs]#chown-Rnobody/var/lib/mfs/
[root@server43mfs]#mfschunkserver
[root@server43mfs]#cd/var/lib/mfs/
[root@server43mfs]#l.
....mfschunkserver.lock
[root@server41x86_64]#scpmfs-client-1.6.27-2.x86_64.rpm192.168.2.44
[root@server44~]#rpm-ivhmfs-client-1.6.27-2.x86_64.rpm
error:
Faileddependencies:
libfuse.so.2()(64bit)isneededbymfs-client-1.6.27-2.x86_64
libfuse.so.2(FUSE_2.4)(64bit)isneededbymfs-client-1.6.27-2.x86_64
libfuse.so.2(FUSE_2.5)(64bit)isneededbymfs-client-1.6.27-2.x86_64
libfuse.so.2(FUSE_2.6)(64bit)isneededbymfs-client-1.6.27-2.x86_64
libfuse.so.2(FUSE_2.7)(64bit)isneededbymfs-client-1.6.27-2.x86_64
libfuse.so.2(FUSE_2.8)(64bit)isneededbymfs-client-1.6.27-2.x86_64
[root@server44mfs]#yumlocalinstall-ymfs-client-1.6.27-2.x86_64.rpm
[root@server44~]#cd/etc/mfs/
[root@server44mfs]#cpmfsmount.cfg.distmfsmount.cfg
[root@server44mfs]#vim/etc/hosts
192.168.2.41mfsmaster
192.168.2.44
[root@server44mfs]#vimmfsmount.cfg
/mnt/mfs
[root@server44mfs]#mkdir/mnt/mfs
[root@server44mfs]#mfsmount
mfsmasteracceptedconnectionwithparameters:
read-write,restricted_ip;rootmappedtoroot:
root
[root@server44mfs]#cp/etc/fstab.
[root@server44mfs]#mfsfileinfofstab
fstab:
chunk0:
0000000000000001_00000001/(id:
1ver:
1)
copy1:
192.168.2.43:
9422
[root@server44mfs]#mkdirdir1dir2
[root@server44mfs]#mkdirdir1dir2
[root@server44mfs]#mvfstabdir1/
[root@server44mfs]#mfssetgoal-r2dir2/
dir2/:
inodeswithgoalchanged:
1
inodeswithgoalnotchanged:
0
inodeswithpermissiondenied:
0
[root@server43mfs]#mfschunkserverstop
[root@server44dir2]#mfsfileinfofstab
fstab:
chunk0:
0000000000000002_00000001/(id:
2ver:
1)
copy1:
192.168.2.42:
9422
[root@server42chunk1]#mfschunkserverstop
[root@server44dir2]#mfsfileinfofstab
fstab:
chunk0:
0000000000000002_00000001/(id:
2ver:
1)
novalidcopies!
!
!
[root@server42chunk1]#mfschunkserver
[root@server44dir2]#mfsfileinfofstab
fstab:
chunk0:
0000000000000002_00000001/(id:
2ver:
1)
copy1:
192.168.2.42:
9422
[root@server44dir2]#vimfstab
修改fstab文件中的内容
sysfs/syssysfsdefaults00
proc/procprocdefaults00
proc/procprocdefaults00
proc/procprocdefaults00
[root@server43mfs]#mfschunkserver
修改文件后,打开server43主机的mfschunkserver服务,文件不能达到同步,所以不会显示server43主机
[root@server44dir2]#mfsfileinfofstab
fstab:
chunk0:
0000000000000004_00000001/(id:
4ver:
1)
copy1:
192.168.2.42:
9422
[root@server44dir2]#ddif=/dev/zeroof=bigfilebs=1Mcount=200
建立一个200M的bigfile文件
[root@server44dir2]#mfsfileinfobigfile
bigfile:
chunk0:
0000000000000007_00000001/(id:
7ver:
1)
copy1:
192.168.2.42:
9422
copy2:
192.168.2.43:
9422
chunk1:
0000000000000008_00000001/(id:
8ver:
1)
copy1:
192.168.2.42:
9422
copy2:
192.168.2.43:
9422
chunk2:
0000000000000009_00000001/(id:
9ver:
1)
copy1:
192.168.2.42: