高效实用,在centos7上搭建MFS分布式文件系统

MFS原理:

MFS是一个具有容错性的网络分布式文件系统,他把数据分散存放在多个物理服务器上,而呈现给用户的则是一个统一的资源

  • MFS文件系统组成:

1、元数据服务器(master)

2、元数据日志服务器(metalogger)

3、数据存储服务器(chunk server)

4、客户端(client)

下面进行MFS分布式文件系统搭建演示

案列环境:

master server:    192.168.100.128
metalogger server:192.168.100.134
chunk server:     192.168.100.132(可以是多台)
client:            192.168.100.131

一、搭建Master Server

(1)下载源码包和安装准备
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0

[[email protected] ~]# yum install gcc gcc-c++ zlib-devel -y
(2)创建用户
[[email protected] ~]# useradd -s /sbin/nologin mfs
(3)安装源码包
[[email protected] ~]# mkdir /abc
[[email protected] ~]# mount.cifs //192.168.100.1/yjs /abc
Password for [email protected]//192.168.100.1/yjs:
[[email protected] ~]# cd /abc
[[email protected] abc]# ls
mfs-1.6.27-5.tar.gz                      

[[email protected] abc]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[[email protected] abc]# cd /opt/mfs-1.6.27/
[[email protected] mfs-1.6.27]# ./config > --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
(4)复制文件
[[email protected] mfs]# ls
mfsexports.cfg.dist  mfsmaster.cfg.dist  mfsmetalogger.cfg.dist  mfstopology.cfg.dist
[[email protected] mfs]# ll
总用量 16
-rw-r--r--. 1 root root 4060 7月  26 16:39 mfsexports.cfg.dist
-rw-r--r--. 1 root root 1020 7月  26 16:39 mfsmaster.cfg.dist
-rw-r--r--. 1 root root  417 7月  26 16:39 mfsmetalogger.cfg.dist
-rw-r--r--. 1 root root 1123 7月  26 16:39 mfstopology.cfg.dist
[[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    //防异常退出
(5)启动Master Server
[[email protected] mfs]# /usr/local/mfs/sbin/mfsmaster start

[[email protected] mfs]# ps -ef |grep mfs
mfs        6699      1  2 16:46 ?        00:00:01 /usr/local/mfs/sbin/mfsmaster start
root       6715   1493  0 16:47 pts/0    00:00:00 grep --color=auto mfs     //检查是否启动

/usr/local/mfs/sbin/mfsmaster -s     //停止Master Server的命令

二、搭建 Metalogger Server

(1)下载源码包及安装准备
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0

[[email protected] ~]# yum install gcc gcc-c++ zlib-devel -y
(2)创建用户
[[email protected] ~]# useradd -s /sbin/nologin mfs
(3)安装源码包
[[email protected] ~]# mkdir /abc
[[email protected] ~]# mount.cifs //192.168.100.1/yjs /abc
Password for [email protected]//192.168.100.1/yjs:
[[email protected] ~]# cd /abc
[[email protected] abc]# ls
mfs-1.6.27-5.tar.gz                      

[[email protected] abc]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[[email protected] abc]# cd /opt/mfs-1.6.27/
[[email protected] mfs-1.6.27]# ./config > --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
(4)复制文件
[[email protected] mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/
[[email protected] mfs]# ll
总用量 16
-rw-r--r--. 1 root root 4060 7月  26 18:00 mfsexports.cfg.dist
-rw-r--r--. 1 root root 1020 7月  26 18:00 mfsmaster.cfg.dist
-rw-r--r--. 1 root root  417 7月  26 18:00 mfsmetalogger.cfg.dist
-rw-r--r--. 1 root root 1123 7月  26 18:00 mfstopology.cfg.dist
[[email protected] mfs]# cp mfsmetalogger.cfg.dist mfsmetalogger.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          //同样需要设置防异常退出
(5)修改metalogger server配置文件
[[email protected] mfs]# vim mfsmetalogger.cfg
MASTER_HOST = 192.168.100.128  //改为Master Server的ip地址
(6)开启Metalogger Server服务
[[email protected] mfs]# /usr/local/mfs/sbin/mfsmetalogger start

[[email protected] mfs]# ps -ef |grep mfs
mfs        6465      1  0 18:03 ?        00:00:00 /usr/local/mfs/sbin/mfsmetalogger start
root       6467   1497  0 18:04 pts/0    00:00:00 grep --color=auto mfs    //检测是否开启

/usr/local/mfs/sbin/mfschunkserver -s  //停止Metalogger Server的命令

三、搭建Chunk Server

(1)下载源码包及安装准备
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0

[[email protected] ~]# yum install gcc gcc-c++ zlib-devel -y
(2)创建用户
[[email protected] ~]# useradd -s /sbin/nologin mfs
(3)安装源码包
[[email protected] ~]# mkdir /abc
[[email protected] ~]# mount.cifs //192.168.100.1/yjs /abc
Password for [email protected]//192.168.100.1/yjs:
[[email protected] ~]# cd /abc
[[email protected] abc]# ls
mfs-1.6.27-5.tar.gz                      

[[email protected] abc]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[[email protected] abc]# cd /opt/mfs-1.6.27/
[[email protected] mfs-1.6.27]# ./config > --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
(4)复制文件
[[email protected] mfs-1.6.27]# cd /usr/local/mfs/etc/mfs/
[[email protected] mfs]# ls
mfschunkserver.cfg.dist  mfshdd.cfg.dist
[[email protected] mfs]# cp mfschunkserver.cfg.dist mfschunkserver.cfg
[[email protected] mfs]# cp mfshdd.cfg.dist mfshdd.cfg
(5)修改配置文件
[[email protected] mfs]# vim mfschunkserver.cfg
MASTER_HOST = 192.168.100.128  //改为Master Server的ip地址

[[email protected] mfs]# vim mfshdd.cfg
/data                //在这里/data是一个给mfs的分区,最好使用独立的分区或磁盘挂载到此目录
(6)创建挂载目录并赋予权限
[[email protected] mfs]# mkdir /data
[[email protected] mfs]# chown -R mfs.mfs /data
(7)启动 Chunk Server
[[email protected] mfs]# /usr/local/mfs/sbin/mfschunkserver start

[[email protected] mfs]# ps -ef | grep mfs
mfs        7366      1  3 18:12 ?        00:00:00 /usr/local/mfs/sbin/mfschunkserver start
root       7392   1455  0 18:12 pts/0    00:00:00 grep --color=auto mfs

四、配置客户端

(1)下载源码包和安装准备
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0

[[email protected] ~]# yum install gcc gcc-c++ zlib-devel -y
(2)安装FUSE源码包
[[email protected] ~]# tar xzvf fuse-2.9.2.tar.gz -C  /opt
[[email protected] ~]# cd /opt/fuse-2.9.7/
[[email protected] fuse-2.9.2]# ./configure
[[email protected] fuse-2.9.2]# make
[[email protected] fuse-2.9.2]# make install

设置环境变量:

[[email protected] fuse-2.9.2]#vi /etc/profile
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
[[email protected] fuse-2.9.2]#source /etc/profile  //刷新文件使生效
(3)安装MFS客户端
[[email protected] fuse-2.9.2]# useradd -s /sbin/nologin mfs
[[email protected] abc]# tar zxvf mfs-1.6.27-5.tar.gz -C /opt
[[email protected] abc]# cd /opt/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

[[email protected] mfs-1.6.27]# make
[[email protected] mfs-1.6.27]# make install
(4)挂载MFS文件系统
[[email protected] mfs-1.6.27]# mkdir /opt/mfs
[[email protected] mfs-1.6.27]# modprobe fuse
[[email protected] mfs-1.6.27]# /usr/local/mfs/bin/mfsmount /opt/mfs -H 192.168.100.128

[[email protected] mfs-1.6.27]# df -TH
文件系统             类型      容量  已用  可用 已用% 挂载点
192.168.100.128:9421 fuse.mfs  6.4G     0  6.4G    0% /opt/mfs
(5)优化客户端
[[email protected] mfs-1.6.27]#vi /etc/profile
export PATH=/usr/local/mfs/bin:$PATH
[[email protected] mfs-1.6.27]#source /etc/profile

[[email protected] mfs-1.6.27]# mfsgetgoal -r /opt/mfs/
/opt/mfs/:
 directories with goal  1 :          1  //mfsgetgoal命令用来查询文件被复制的份数,-r表示递归,goal指文件被复制的份数

五、MFS监控

Mfscgiserv是用python语言编写的一个web服务器,监听端口为9425,可以在Master Server上通过命令 /usr/local/mfs/sbin/mfscgiserv来启动。

 在客户端上通过浏览器访问http:Master Server_ip:9425查看

原文地址:http://blog.51cto.com/13687553/2150949

时间: 2024-08-24 18:19:00

高效实用,在centos7上搭建MFS分布式文件系统的相关文章

在CentOS7上部署MFS分布式文件系统

MFS原理 MFS是一个具有容错性的网络分布式文件系统,它把数据分散存放在多个物理服务器上,而呈现给用户的则是一个统一的资源. 1)MFS文件系统的组成 MFS文件系统的组成架构如图所示. 元数据服务器(Master):在整个体系中负责管理文件系统,维护元数据. 元数据日志服务器(MetaLogger):备份Master服务器的变化日志文件,文件类型为changelog_ml.*.mfs.当Master服务器数据丢失或者损坏时,可以从日志服务器中取得文件,进行恢复. 数据存储服务器(Chunk

搭建 MFS 分布式文件系统

MFS分布式文件系统 MFS是一种半分布式文件系统,它是由波兰人开发的.MFS文件系统能够实现RAID的功能,不但能够更节约存储成本,而且不比专业的存储系统差,它还可以实现在线扩展. 分布式文件系统是指文件系统管理的物理存储资源下不一定直接连接在本地节点上,而是通过计算机网络与节点相连. 分布式文件系统的优点是集中访问.简化操作.数据容灾,以及提高了文件的存取性能. MFS文件系统的组成架构: 元数据服务器(Master):在整个体系中负责管理文件系统,维护元数据: 元数据日志服务器(Metal

CentOS 7下搭建MFS分布式文件系统

MFS原理 MFS是一个具有容错性的网络分布式文件系统,它把数据分散存放在多个服务器上,而呈现给用户的则是一个统一的资源. MFS文件系统的组成架构: 元数据服务器(Master):在整个体系中负责管理文件系统,维护元数据: 元数据日志服务器(Metalogger):备份Master服务器的变化日志文件,文件类型为changlog_ml.*.mfs.当Master服务器数据丢失或者损坏时,可以从日志服务器中取得文件,进行恢复: 数据存储服务器(Chunk Server):真正存储的数据的服务器.

搭建MFS分布式文件系统

MFS原理 MFS 是一个具有容错性的网络分布式文件系统.它把数据分散存放在多个物理服务器上,而呈现给用户的则是一个统一的资源. MFS的组成 管理服务器 Master: 负责各个数据存储服务器的管理,文件读写调度,文件空间回收以及恢复.多节点拷贝 元数据日志服务器 MetaLogger: 负责备份 master 服务器的变化日志文件,文件类型为 changelog_ml.*.mfs,以便于在 master 出问题的时候.从日志服务器取得文件,进行恢复 数据存储服务器 chunk servers

Linux搭建MFS分布式文件系统

说明: 架构规划 元数据服务器     mfs-master-1             172.16.100.2 备份服务器       mfs-metalogger           172.16.100.4 数据存储服务器   mfs-chunkserver-1        172.16.100.5 数据存储服务器   mfs-chunkserver-2        172.16.100.6 数据存储服务器   mfs-chunkserver-3        172.16.100.

在 Ubuntu 上搭建 Eadoop 分布式集群 Eclipse 开发环境

一直在忙Android FrameWork,终于闲了一点,利用空余时间研究了一下Hadoop,并且在自己和同事的电脑上搭建了分布式集群,现在更新一下blog,分享自己的成果. 一 .环境 1.操作系统:Ubuntu 12.04 LTS 64位 2.Java版本:openjdk-7-jdk 3.Hadoop版本:2.6.0 4.结点信息: 机器名 IP hostname 作用 master 10.13.14.83 rdcdz140395 NameNode and JobTracker slave-

在Centos7上搭建局域网的yum源仓库

1.#输入命令rmp -q -vsftpd,查看是否安装了该包. 2.#创建挂载点,把光盘挂载到该点 3.#使用命令用rpm-ivh 安装vsftpd安装包 4.#启动vsftpd服务,设为下次开机启动. 5.#输入ifconfig,找到自己的局域网地址,看是否连接超时,如果超时就是没关闭防火墙的原因,那么就关闭防火墙.(学习环境中关闭防火墙就行了,不支持实际工作环境中关闭). 6.#用浏览器访问自己的局域网地址 ,会出现以下页面,说明ftp服务配置成功. 7.#创建文件夹,将CentOS7安装

linux,centos7上搭建LVS负载均衡

在linux,centos7上搭建LVS负载均衡 实前准备 准备五台虚拟机 四台centos7 一台做调度 一台做nfs缓存 两台做wed群集 一台windows7 开始逐个配置 配置nfs服务器(centos7在用的时候是在线下载源代码包但是为了做实验先把源代码用yum安装好后改为仅主机模式) IP:192.168.10.174 用rpm -q nfs-utils查看有没有安装 rpcbind (远程过程调用) 编辑配置文件 [[email protected] ~]# vim /etc/ex

在Centos7上搭建Nginx+rtmp服务器

在VPS服务器上配置一个直播环境,在iOS客户端实现推流到直播服务器,通过VLC播放器实现拉取服务器上的流观看直播. 效果图 Demo_01 Centos7上搭建Nginx+rtmp服务器 今天第一次在Centos7上搭建Nginx+rtmp服务器,以前在Mac上成功搭建,所以今天想在Centos7上试一试,在此记录一下,过程还是比较顺利. (1)准备需要的模块及工具(nginx-rtmp-module,openssl和git) 1.使用yum安装git [root~]# yum -y inst