MFS分布式文件系统之安装部署
Moose File System 是一个具备容错功能的网络分布式文件系统,它将数据分布在网络中的不同服务器上
管理服务器 (managing server) | 负责各个数据存储服务器的管理,文件读写调度,文件空间回收以及恢复.多节点拷贝 |
元数据日志服务器 (Metalogger server) | 负责备份master服务器的变化日志文件,文件类型为changelog_ml.*.mfs,以便于在master server出问题的时候接替其进行工作 |
数据存储服务器 (data servers) | 负责连接管理服务器,听从管理服务器调度,提供存储空间,并为客户提供数据传输. |
客户机挂载使用 (client computers) | 通过fuse内核接口挂接远程管理服务器上所管理的数据存储服务器,.看起来共享的文件系统和本地unix文件系统使用一样的效果. |
主机名 | IP | 安装的软件 | 运行的进程 |
MASTER | 192.169.20.188 | Zlib libpcap fuse mfs | mfsmaster |
METALOGGER | 192.168.20.185 | Zlib libpcap fuse mfs | mfsmetalogger |
CHUNK | 192.168.20.193 | Zlib libpcap fuse mfs | Mfschunk |
CHUNK2 | 192.168.20.156 | Zlib libpcap fuse mfs | Mfschunk |
CLIENT | 192.168.20.* | Zlib libpcap fuse mfs | mfsmount |
当前版本:MooseFS 3.0.55
稳定版:MooseFS 2.0.77
https://moosefs.com/download/sources.html选择稳定版
# tar zxf moosefs-2.0.77-1.tar.gz
# useraddmfs -M -s /sbin/nologin # id mfs uid=501(mfs) gid=501(mfs) 组=501(mfs) |
1.4 编译安装zlib libpcap和fuse依赖包(除client端需要fuse外,其他可以不安装)
编译安装zlib http://www.zlib.net/ #下载zlib # tar zxf zlib-1.2.8.tar.gz # cd zlib-1.2.8 # ./configure && make && make install 编译安装pcap http://www.tcpdump.org/#latest-release #下载pcap # tar zxf libpcap-1.7.4.tar.gz # cd libpcap-1.7.4 # ./configure && make && make install 编译安装fuse: http://sourceforge.net/projects/fuse/files/fuse-2.X/ #下载fuse # cd fuse-2.9.4 # ./configure --prefix=/usr # prefix指定目录,我们安装到/usr下,这样fuse的库文件就自动安装到了/usr/lib,免去了我们手工指定链接库的麻烦 make && make install |
# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs # make && make install |
用到的文件etc下的mfsmaster.cfg,用到的工具sbin下的mfsmaster。
2.1 创建配置文件
#cp /usr/local/mfs/etc/mfs/mfsmaster.cfg.dist /usr/local/mfs/etc/mfs/mfsmaster.cfg 修改: MATOCS_LISTEN_HOST =172.20.1.61 # cp /usr/local/mfs/etc/mfs/mfsexports.cfg.dist /usr/local/mfs/etc/mfs/mfsexports.cfg # cp /usr/local/mfs/etc/mfs/mfstopology.cfg.dist /usr/local/mfs/etc/mfs/mfstopology.cfg # cpmetadata.mfs.emptymetadata.mfs |
# /usr/local/mfs/sbin/mfsmaster start open files limit has been set to: 4096 working directory: /usr/local/mfs/var/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 192.168.20.188:9420 main master server module: listen on *:9421 mfsmaster daemon initialized properly # /usr/local/mfs/sbin/mfscgiserv start #开启WEB监控页面进程 http://ip:9425查看mfs系统状态 |
usage:
/usr/local/mfs/sbin/mfsmaster
[-vfun] [-tlocktimeout] [-c cfgfile] [-i] [-a] [-e] [-x [-x]]
[start|stop|restart|reload|info|test|kill]
-v | print version number and exit显示版本或退出 |
-f | run in foreground在前台运行 |
-u | log undefined config variables记录未定义的可用配置 |
-n | do not attempt to increase limit of core dump size 不尝试增加核心转储大小限制 |
-t | locktimeout : how long wait for lockfile lockfile等待时长 |
-c | cfgfile : use given config file使用指定配置文件 |
-i | ignore some metadata structure errors (attach orphans to root, ignore names without inode, etc.)忽略元数据结构错误 |
-a | automatically restore metadata from change logs 自动从更改日志恢复元数据 |
-e | start without metadata (download all from leader) 不从元数据启动,所有从leader下载 |
-xx | even more verbose output更详细输出 |
-x | produce more verbose output产生更详细输出 |
http://www.zlib.net/ #下载zlib # tar zxf zlib-1.2.8.tar.gz # cd zlib-1.2.8 # ./configure && make && make install http://www.tcpdump.org/#latest-release #下载pcap # tar zxf libpcap-1.7.4.tar.gz # cd libpcap-1.7.4 # ./configure && make && make install http://sourceforge.net/projects/fuse/files/fuse-2.X/ #下载fuse # cd fuse-2.9.4 # ./configure --prefix=/usr make && make install |
# useradd mfs -M -s /sbin/nologin |
# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs # make && make install |
用到的文件etc下的mfschunkserver.cfg和mfshdd.cfg,
用到的工具sbin下的mfschunkserver
# cpmfschunkserver.cfg.dist mfschunkserver.cfg # cp /usr/local/mfs/etc/mfs/mfshdd.cfg.dist /usr/local/mfs/etc/mfs/mfshdd.cfg # vi etc/mfs/mfschunkserver.cfg MASTER_HOST = 192.168.20.188 |
# Echo “ - - -” > /sys/class/scsi_host/host0/scan # Fdisk –l /dev/sdb Disk /dev/sdb: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 |
# fdisk -c /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0xa3e03970. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won‘t be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: cylinders as display units are deprecated. Use command ‘u‘ to change units to sectors. Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-1305, default 1): Using default value 1 Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): Using default value 1305 Command (m for help): t Selected partition 1 Hex code (type L to list codes): 8e Changed system type of partition 1 to 8e (Linux LVM) Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. |
# vgcreate mfs /dev/sdb1 Physical volume "/dev/sdb1" successfully created Volume group "mfs" successfully created |
# lvcreate -L 8G -n lvmfs mfs # vgs VG #PV #LV #SN Attr VSize VFree mfs 1 1 0 wz--n- 9.99g 1.99g # lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lvmfs mfs -wi-a----- 8.00g
|
# mkfs.ext4 /dev/mapper/mfs-lvmfs # mount /dev/mapper/mfs-lvmfs /data/ # df -h /data #查看是否成功挂载 Filesystem Size Used Avail Use% Mounted on /dev/mapper/mfs-lvmfs 7.8G 18M 7.4G 1% /data
|
# Vi /etc/fstab UUID=71628bae-bc06-434c-9f1f-e01929ffd164 /data ext4 defaults 0 0 # Umount /data #卸载 # df -h /data #查看是否卸载 Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg-root 19G 5.7G 12G 33% / # mount –a #重新挂载所有设备 # df -h /data查看挂载情况 Filesystem Size Used Avail Use% Mounted on /dev/mapper/mfs-lvmfs 7.8G 18M 7.4G 1% /data |
# vi etc/mfs/mfshdd.cfg /data # chown -R mfs.mfs /data |
vi /etc/profile PATH=$PATH:/usr/local/mfs:/usr/local/mfs/sbin source /etc/profile |
# mfschunkserver start open files limit has been set to: 16384 working directory: /usr/local/mfs/var/mfs lockfile created and locked setting glibc malloc arena max to 8 setting glibc malloc arena test to 1 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 |
两台chunkserver做相同配置
http://www.zlib.net/ #下载zlib # tar zxf zlib-1.2.8.tar.gz # cd zlib-1.2.8 # ./configure && make && make install http://www.tcpdump.org/#latest-release #下载pcap # tar zxf libpcap-1.7.4.tar.gz # cd libpcap-1.7.4 # ./configure && make && make install http://sourceforge.net/projects/fuse/files/fuse-2.X/ #下载fuse # cd fuse-2.9.4 # ./configure --prefix=/usr make && make install |
useradd mfs -M -s /sbin/nologin
# ./configure --prefix=/usr/local/mfs --with-default-user=mfs --with-default-group=mfs --enable-mfsmount # make && make install |
mkdir /mfs
mfsmount /mnt –H 192.168.20.188
本文出自 “千面” 博客,请务必保留此出处http://oslibo.blog.51cto.com/10854638/1711903
原文地址:http://oslibo.blog.51cto.com/10854638/1711903