环境搭建
[root@server1 ~]# curl "http://ppa.moosefs.com/MooseFS-3-el7.repo" > /etc/yum.repos.d/MooseFS.repo
这里注意需要把gpg检测关掉
[root@server1 ~]# yum install moosefs-master moosefs-cgi moosefs-cgiserv moosefs-cli -y
[root@server1 ~]# systemctl start moosefs-master # 开启服务
[root@server1 ~]# netstat -antlp

需要做好本地解析

开启图形化监控服务
[root@server1 mfs]# systemctl start moosefs-cgiserv.service
[root@server1 mfs]# netstat -antlp

添加一个主机,server2
[root@server2 ~]# yum install moosefs-chunkserver -y
[root@server2 ~]# vim /etc/hosts
[root@server2 ~]# fdisk -l #这里我加入了10g的vdb

[root@server2 ~]# fdisk /dev/vdb
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-20971519, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519):
Using default value 20971519
Partition 1 of type Linux and of size 10 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@server2 ~]# mkfs.xfs /dev/vdb1
[root@server2 ~]# mkdir /mnt/chunk1
[root@server2 ~]# mount /dev/vdb1 /mnt/chunk1/
[root@server2 ~]# blkid

[root@server2 ~]# vim /etc/fstab
[root@server2 ~]# mount -a

[root@server2 ~]# chown mfs.mfs /mnt/chunk1/
[root@server2 ~]# cd /etc/mfs/
[root@server2 mfs]# vim mfshdd.cfg
[root@server2 mfs]# systemctl restart moosefs-chunkserver

server3
[root@server3 ~]# yum install moosefs-chunkserver -y
[root@server3 ~]# vim /etc/hosts
[root@server3 ~]# cd /etc/mfs/
[root@server3 mfs]# vim mfshdd.cfg
[root@server3 mfs]# mkdir /mnt/chunk2
[root@server3 mfs]# cd /mnt/
[root@server3 mnt]# ls
chunk2
[root@server3 mnt]# chown mfs.mfs chunk2/
[root@server3 mfs]# systemctl start moosefs-chunkserver

访问http://172.25.3.1:9425 查看效果

这里我使用真机作为client
[root@zhenji Desktop]# curl "http://ppa.moosefs.com/MooseFS-3-el8.repo" > /etc/yum.repos.d/MooseFS.repo
[root@zhenji yum.repos.d]# vim /etc/hosts
[root@zhenji yum.repos.d]# cd
[root@zhenji ~]# mkdir /mnt/mfs
[root@zhenji ~]# cd /etc/mfs/
[root@zhenji mfs]# vim mfsmount.cfg
[root@zhenji mfs]# cd
[root@zhenji ~]# mfsmount
[root@zhenji ~]# cd /mnt/mfs/
[root@zhenji mfs]# mkdir dir1
[root@zhenji mfs]# mfsgetgoal dir1
dir1: 2
[root@zhenji mfs]# mkdir dir2
[root@zhenji mfs]# mfsgetgoal dir2
dir2: 2
[root@zhenji mfs]# cd dir1/
[root@zhenji dir1]# cp /etc/passwd .
[root@zhenji dir1]# mfsfileinfo passwd

[root@zhenji dir1]# cd ..
[root@zhenji mfs]# cd dir2/
[root@zhenji dir2]# ls
[root@zhenji dir2]# cp /etc/fstab .
[root@zhenji dir2]# mfsfileinfo fstab

这里再重新开一台server4,配置同上。

[root@zhenji mnt]# cd mfs
[root@zhenji mfs]# ls
dir1 dir2
[root@zhenji mfs]# cd dir1/
[root@zhenji dir1]# cd ../dir2
[root@zhenji dir2]# ls
fstab
[root@zhenji dir2]# dd if=/dev/zero of=bigfile bs=1M count=200
[root@zhenji dir2]# mfsfileinfo bigfile

查看文件在垃圾回收站存放时间
[root@zhenji dir2]# mfsgettrashtime fstab
fstab: 86400
文件找回
[root@zhenji mnt]# mkdir mfsmeta
[root@zhenji mnt]# cd mfsmeta/
[root@zhenji mfsmeta]# cd ..
[root@zhenji mnt]# cd ~/
[root@zhenji ~]# mfsmount -m /mnt/mfsmeta/
[root@zhenji dir2]# rm -f fstab
[root@zhenji dir2]# cd /mnt/mfsmeta/
[root@zhenji mfsmeta]# ls
sustained trash
[root@zhenji mfsmeta]# cd trash/
[root@zhenji trash]# find -name *fstab*
[root@zhenji trash]# cd 005/
[root@zhenji 005]# mv 00000005\|dir2\|fstab undel/
[root@zhenji 005]# ls /mnt/mfs/dir2/

[root@zhenji mfs]# mfsscadmin create 2A sclass1
[root@zhenji mfs]# mfsscadmin list


[root@server2 mfs]# vim mfschunkserver.cfg
[root@server2 mfs]# systemctl reload moosefs-chunkserver.service


配置规则如下:

[root@zhenji dir2]# cp /etc/passwd .
[root@zhenji dir2]# ls
bigfile fstab passwd
[root@zhenji dir2]# mfsfileinfo passwd
passwd:
chunk 0: 0000000000000007_00000001 / (id:7 ver:1)
copy 1: 172.25.3.3:9422 (status:VALID)
copy 2: 172.25.3.4:9422 (status:VALID)
[root@zhenji dir2]# mfssetsclass sclass1 passwd
[root@zhenji dir2]# mfsfileinfo passwd
passwd:
chunk 0: 0000000000000007_00000001 / (id:7 ver:1)
copy 1: 172.25.3.2:9422 (status:VALID)
copy 2: 172.25.3.3:9422 (status:VALID)

[root@zhenji dir2]# mfsscadmin create A,B sclass2
本文详细介绍MooseFS分布式文件系统的环境搭建过程,包括主服务器、块服务器的配置及客户端挂载步骤,并演示了文件操作及存储策略设置。
1075

被折叠的 条评论
为什么被折叠?



