Centos Installation Moosefs File system

Source: Internet
Author: User

I. Introduction to the Environment
Moosefs master:192.168.55.148
Moosefs metalogger:192.168.55.149
Moosefs chunk-01:192.168.55.150
Moosefs chunk-02:192.168.55.151

Moosefs client:192.168.55.152

Two. Installation

#########################################################
1) Master Installation

$ yum install-y wget gcc zlib zlib-devel$ cd/usr/local/src$ groupadd mfs$ useradd-g MFS mfs-s/sbin/nologin-m$ wget H ttp://www.moosefs.org/tl_files/mfscode/mfs-1.6.27-1.tar.gz$ tar zxvf mfs-1.6.27-1.tar.gz$ cd CD mfs-1.6.27$. Configure--prefix=/usr/local/mfs--with-default-user=mfs--with-default-group=mfs--disable-mfschunkserver-- disable-mfsmount$ make$ make Install

  

$ CP rpm/rh/mfsmaster.init/etc/init.d/mfsmaster$ CP rpm/rh/mfscgiserv.init/etc/init.d/mfscgiserv$ chmod 755/etc/ init.d/mfsmaster$ chmod 755/etc/init.d/mfscgiserv$ ln-s/usr/local/mfs/sbin/mfsmaster/usr/sbin/$ ln-s/usr/local/mfs /sbin/mfscgiserv/usr/sbin/$ ln-s/usr/local/mfs/etc/mfs/etc/mfs$ cd/usr/local/mfs/etc/mfs$ CP mfsmaster.cfg.dist mfsmaster.cfg$ CP mfsmetalogger.cfg.dist mfsmetalogger.cfg$ CP mfsexports.cfg.dist mfsexports.cfg$ CP Mfstopology.cfg.dist mfstopology.cfg

  

[Email protected] mfs]# more Mfsexports.cfg | Grep-v "^#" */RW,ALLDIRS,MAPROOT=0*.RW

  

$ cd/usr/local/mfs/var/mfs/$ cp metadata.mfs.empty metadata.mfs$ vi/etc/hosts1921.68.55.148 Mfsmaster

  

 

$ vi/etc/init.d/mfsmaster #!/bin/bash## init file for the Moosefs master service## chkconfig:-$ 84## Description:moos EFS master## processname:mfsmaster# config: @[email protected]/mfsmaster.cfg# Source function Library. /etc/init.d/functions# Source Networking configuration: /etc/sysconfig/network# Check that networking are up. ["${networking}" = = "No"] && exit 0[-X "/usr/sbin/mfsmaster"] | | Exit 1[-R "/etc/mfs/mfsexports.cfg"-o-r "/etc/mfs/mfsexports.cfg"] | | Exit 1retval=0prog= "Mfsmaster" Start () {echo-n $ "starting $prog:" Daemon $prog $OPTIONSRETVAL =$?echo[$RETVAL-eq 0] &am p;& touch/var/lock/subsys/$progreturn $RETVAL}stop () {echo-n $ "stopping $prog:" $prog Stop $OPTIONS | | Killproc $prog >/dev/null 2>&1retval=$?echo[$RETVAL-eq 0] && rm-f/var/lock/subsys/$progreturn $RETV Al}restart () {stopstart}case "$" instart) start; stop) stop;; restart|reload) restart;; Condrestart) [-e/var/lock/subsys/$prog] && restartretval=$?;; Status) status $progRETVAL =$?;; *) echo $ "Usage: $ start|stop|restart|condrestart|status}" Retval=1esacexit $RETVAL

  

$ touch/usr/local/mfs/var/mfs/.mfscgiserv.lock$ chmod 777/usr/local/mfs/var/mfs/.mfscgiserv.lock

  

$ vi/etc/init.d/mfscgiserv #!/bin/bash## init file for the Moosefs CGI monitor service## chkconfig:-83## description : Moosefs CGI server## processname:mfscgiserv# Source function library. /etc/init.d/functions# Source Networking configuration: /etc/sysconfig/networkmfscgiserv_user=nobody# Source initialization configuration.# Check that networking are up. ["${networking}" = = "No"] && exit 0[-X "/usr/sbin/mfscgiserv"] | | Exit 1retval=0prog= "Mfscgiserv" Start () {echo-n $ "starting $prog:" Daemon--user $MFSCGISERV _user $prog $OPTIONSRETVAL =$ echo[$RETVAL-eq 0] && touch/var/lock/subsys/$progreturn $RETVAL}stop () {echo-n $ "stopping $prog:" $prog sto P $OPTIONS | | Killproc $prog >/dev/null 2>&1retval=$?echo[$RETVAL-eq 0] && rm-f/var/lock/subsys/$progreturn $RETV Al}restart () {stopstart}case "$" instart) start; stop) stop;; restart|reload) restart;; Condrestart) [-e/var/lock/subsys/$prog] && restartretval=$?;; Status) Status $progRETVal=$?;; *) echo $ "Usage: $ start|stop|restart|condrestart|status}" Retval=1esacexit $RETVAL

  

$/etc/init.d/mfsmaster$/etc/init.d/mfscgiserv start$ chkconfig--add mfsmaster$ chkconfig-add mfscgiserv$ chkconfig Mf Smaster on$ chkconfig Mfscgiserv on

  


#################################################################
2) Metalogger Server Install

$ yum install-y wget gcc zlib zlib-devel$ cd/usr/local/src/$ groupadd mfs$ useradd-g MFS mfs-s/sbin/nologin-m$ tar Z XVF mfs-1.6.27-1.tar.gz$ cd mfs-1.6.27$./configure--prefix=/usr/local/mfs--with-default-user=mfs-- With-default-group=mfs--disable-mfschunkserver--disable-mfsmount$ make$ make install

  

$ ln-s/usr/local/mfs/sbin/mfsmetalogger/usr/sbin/$ ln-s/usr/local/mfs/etc/mfs/etc/mfs$ CP rpm/rh/ mfsmetalogger.init/etc/init.d/mfsmetalogger$ chmod 755/etc/init.d/mfsmetalogger$ cd/usr/local/mfs/etc/mfs/$ CP Mfsmetalogger.cfg.dist mfsmetalogger.cfg$ vi/etc/hosts$ 192.168.55.149 mfsmaster

  

$ vi/etc/init.d/mfsmetalogger #!/bin/bash## init file for the moosefs metalogger service## chkconfig:-€ 84## descripti On:moosefs metalogger## processname:mfsmetalogger# config: @[email protected]/mfsmetalogger.cfg# Source function library. /etc/init.d/functions# Source Networking configuration: /etc/sysconfig/network# Source Initialization configuration.#[-R "/usr/sbin/mfsmetalogger"] &&. /usr/sbin/mfsmetalogger# Check that networking are up. ["${networking}" = = "No"] && exit 0[-X "/usr/sbin/mfsmetalogger"] | |  Exit 1retval=0prog= "Mfsmetalogger" Start () {echo-n $ "starting $prog:" Daemon $prog $OPTIONSRETVAL =$?echo[$RETVAL-eq 0] && touch/var/lock/subsys/$progreturn $RETVAL}stop () {echo-n $ "stopping $prog:" $prog Stop $OPTIONS | | Killproc $prog >/dev/null 2>&1retval=$?echo[$RETVAL-eq 0] && rm-f/var/lock/subsys/$progreturn $RETV Al}restart () {stopstart}case "$" instart) start; stop) stop;; restart|reload) restart;; CondresTart) [-e/var/lock/subsys/$prog] && restartretval=$?;; Status) status $progRETVAL =$?;; *) echo $ "Usage: $ start|stop|restart|condrestart|status}" Retval=1esacexit $RETVAL

  

$ chkconfig--add mfsmetalogger$ chkconfig Mfsmetalogger on

  

############################################################
3) Chunk Server Install

$ yum install-y wget gcc zlib zlib-devel$ cd/usr/local/src/$ groupadd mfs$ useradd-g MFS mfs-s/sbin/nologin-m$ tar Z XVF mfs-1.6.27-1.tar.gz$ cd mfs-1.6.27$./configure--prefix=/usr/local/mfs--with-default-user=mfs-- With-default-group=mfs--disable-mfsmaster$ make$ make install

  

$ ln-s/usr/local/mfs/etc/mfs/etc/mfs$ ln-s/usr/local/mfs/sbin/mfschunkserver/usr/sbin/$ CP rpm/rh/ mfschunkserver.init/etc/init.d/mfschunkserver$ chmod 755/etc/init.d/mfschunkserver

  

$ cd/usr/local/mfs/etc/mfs$ cp mfshdd.cfg.dist mfshdd.cfg$ CP mfschunkserver.cfg.dist mfschunkserver.cfg

  

#创建2个挂载磁盘 $ mkdir-p/storage/mfschunks$ dd If=/dev/zero of=/storage/mfschunks/mfschunks1 bs=1024 count=1 seek=$ ((2*1024 *1024-1) $ mkfs-t ext4/storage/mfschunks/mfschunks1$ mkdir-p/mnt/mfschunks1$ mount-t ext4-o loop/storage/mfschunks/ mfschunks1/mnt/mfschunks1$ DD If=/dev/zero of=/storage/mfschunks/mfschunks2 bs=1024 count=1 seek=$ ((2*1024*1024-1)) $ Mkfs-t ext4/storage/mfschunks/mfschunks2$ mkdir-p/mnt/mfschunks2$ mount-t ext4-o loop/storage/mfschunks/mfschunks2 /mnt/mfschunks2$ Chown-r Mfs:mfs/mnt/mfschunks1/mnt/mfschunks2

  

#编辑添加挂载分区 $ vi/etc/mfs/mfshdd.cfg# mount points of HDD Drives##/mnt/hd1#/mnt/hd2#etc./mnt/mfschunks1/mnt/mfschunks2

  

#写入hosts $ vi/etc/hosts192.168.55.148 Mfsmaster

  

$ vi/etc/init.d/mfschunkserver #!/bin/bash## init file for the moosefs chunkserver service## chkconfig:-83## Descrip Tion:moosefs chunkserver## processname:mfschunkserver# config: @[email protected]/mfschunkserver.cfg# Source function library. /etc/init.d/functions# Source Networking configuration: /etc/sysconfig/network# Source Initialization configuration.#[-R "/usr/sbin/mfschunkserver"] &&. /usr/sbin/mfschunkserver# Check that networking are up. ["${networking}" = = "No"] && exit 0[-X "/usr/sbin/mfschunkserver"] | | Exit 1[-R "/etc/mfs/mfshdd.cfg"-o-r "/etc/mfs/mfshdd.cfg"] | | Exit 1retval=0prog= "Mfschunkserver" Start () {echo-n $ "starting $prog:" Daemon $prog $OPTIONSRETVAL =$?echo[$RETVAL-eq 0 ] && touch/var/lock/subsys/$progreturn $RETVAL}stop () {echo-n $ "stopping $prog:" $prog Stop $OPTIONS | | Killproc $prog >/dev/null 2>&1retval=$?echo[$RETVAL-eq 0] && rm-f/var/lock/subsys/$progreturn $RETV Al}restart () {StOpstart}case "$" instart) start; stop) stop;; restart|reload) restart;; Condrestart) [-e/var/lock/subsys/$prog] && restartretval=$?;; Status) status $progRETVAL =$?;; *) echo $ "Usage: $ start|stop|restart|condrestart|status}" Retval=1esacexit $RETVAL

  

$ chkconfig--add mfschunkserver$ chkconfig mfschunkserver on


###############################################
4) Client Install

$ yum install-y wget gcc zlib zlib-devel$ cd/usr/local/src/$ groupadd mfs$ useradd-g MFS mfs-s/sbin/nologin-m$ wget http://nchc.dl.sourceforge.net/project/buluoos/0.2/src/fuse-2.8.5.tar.gz$ tar zxvf fuse-2.8.5.tar.gz$ cd fuse-2.8.5 $./configure$ make && make install$ echo ' export pkg_config_path=/usr/local/lib/pkgconfig: $PKG _config_path ' >>/etc/profile$ source/etc/profile$ lsmod |grep fusefuse 73530 0

  

#################################
#lsmod |grep Fuse #检查fuse是否加载到内核, if not, execute the command below
#modprobe fuse&&lsmod |grep Fuse
###############################

$ cd/usr/local/src/$ tar zxvf mfs-1.6.27-1.tar.gz$ cd mfs-1.6.27$./configure--prefix=/usr/local/mfs-- With-default-user=mfs--with-default-group=mfs--$ disable-mfsmaster--disable-mfschunkserver$ make$ make install$ LN- s/usr/local/mfs/bin/*/usr/sbin/

  

$ vi/etc/hosts192.168.1.1 mfsmaster$ mkdir-p/mnt/mfs$/usr/local/mfs/bin/mfsmount/mnt/mfs-h mfsmaster$ df-hfilesyste M Size used Avail use% mounted on/dev/mapper/volgroup-lv_root 11G 948M 8.8G 10%/tmpfs 116M 0 116M 0%/dev/shm/dev/sda1 48 5M 32M 428M 7%/bootmfsmaster:9421 6.3G 0 6.3G 0%/mnt/mfs

  

# # #TEST # #
Write
Time DD If=/dev/zero of=/mnt/mfs/test500m bs=1024k count=500
500+0 Records in
500+0 Records out
524288000 bytes (524 MB) copied, 6.14798 s, 85.3 MB/s

real0m6.173s
user0m0.001s
sys0m0.973s

Read
Time DD if=/mnt/mfs/test500m Of=/dev/null

[Email protected] mfs]# mkdir #创建目录

  

[Email protected] mfs]# mfssetgoal 2/MNT/MFS/10 #设置副本份数/mnt/mfs/10:2

  

[Email protected] mfs]# mfsgetgoal-r/MNT/MFS/10 #查看副本数/mnt/mfs/10:directories with Goal 2:1

  

[Email protected] mfs]# mfssettrashtime-r 0/MNT/MFS/10 #设置延迟删除时间/mnt/mfs/10:inodes with Trashtime changed:1inodes with Trashtime not changed:0inodes with permission denied:0

  

[Email protected] mfs]# mfsgettrashtime-r/MNT/MFS/10 #查看延迟删除时间/mnt/mfs/10:directories with Trashtime 0:1

  

[Email protected] mfs]# mfscheckfile/mnt/mfs/10/d.jpg #查看文件副本数/mnt/mfs/10/d.jpg:chunks with 2 copies:1

  

[Email protected] mfs]# mfsfileinfo/mnt/mfs/10/d.jpg #查看文件储存详细信息/mnt/mfs/10/d.jpg:chunk 0:00000000000000c5_ 00000001/(id:197 ver:1) copy 1:192.168.55.150:9422copy 2:192.168.55.151:9422

  

[Email protected] mfs]# mfsdirinfo/mnt/mfs/10/mnt/mfs/10/:inodes:2directories:1files:1chunks:1length:186050size: 201728realsize:403456

  





#查看日志, the default print is below/var/log/messages
Tail-f/var/log/messages

#故障切换 (summary from the network)
(1) The Metalogger server needs to back up the two configuration files of master, because the configuration file does not change frequently, so the file synchronization through the timed script.

(2) If Metalogger does not download metadata, it cannot use the period to take over master. At this point the Metarestore program will fail to run.

(3) The Metarestore program is based on regular downloads of metadata and changelog in Metalogger to restore Master's hang-off time master records the entire MFS information.


Metalogger precautions

1. The number of open files for the server deploying Metalogger must be greater than or equal to 5000.

2, Metalogger will not download metadata at startup, but wait until the download time of the first download cycle to download, Metalogger download metadata time point is 10 minutes 30 seconds per hour, the time interval is 1 hours of integer times.

3, Metalogger not at the start of the time to take off the load metadata, but must wait until the download time point (2) to download. In other words, metalogger to ensure correctness, the master and Metalogger should be kept in good condition for at least one hours after startup.

Centos Installation Moosefs File system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.