From Notes Wiki
Jump to: navigation, search


There are updated articles on this at CentOS 8.x Moosefs 3.x

Installing mooseFS

Installing using yum

  1. yum install mfs mfs-cgi mfs-client
  2. groupadd mfs
  3. useradd -g mfs mfs

Installing from source

  1. Download latest source code from The website also contains tutorials on how to install and use mooseFS
  2. groupadd mfs
  3. useradd -g mfs mfs
  4. tar -xzf mfs-*.tar.gz
  5. cd mfs-*
  6. ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib --with-default-user=mfs --with-default-group=mfs
    We can disable chunkserver using --disable-mfschunkserver option with configure. We can disable mfsmount with --disable-mfsmount option. These options can be useful for creating dedicated master server which will not act as chunk server.
    We can optionally disable master server installation on chunkserver using --disable-mfsmaster option
  7. make
  8. make install

Configuring moooseFS

  1. Go to /etc/ or /etc/mfs based on where installation is done by source or by yum
  2. cp mfsmaster.cfg.dist mfsmaster.cfg
    This file is used to configure mfs master server. Refer to man mfsmaster.cfg for information about parameters configured in this file.
  3. cp mfsexports.cfg.dist mfsexports.cfg
    This file is used to access control which clients can connect to mfs server. Refer to man mfsexports.cfg for more information on syntax and options available in this file.
  4. Add password=<secret> in mfsexports.cfg file for both / and . Do not leave space between various options they should be separated just by comma (,).
  5. cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
    This needs to be done only on mfs metalogger server. mfs metalogger server is backup server for mfs master server and takes over mfs operations in case mfs master server fails. Hence there is not point in creating metalogger server on same machine as mfs master server.
  6. cd /var/mfs; mv metadata.mfs.empty metadata.mfs
  7. Edit /etc/hosts so that name mfsmaster points to mfsmasters' ethernet IP address.
  8. service mfsmaster start; chkconfig mfsmaster on
    This only needs to be done on mfsmaster server.
  9. Use command mfscgiserv to start mfs CGI server. Then open http://<IP_address>:9425/ in browser
  10. server mfsmetalogger start; chkconfig metalogger on
    This needs to be done only on mfs metalogger server.
  11. cp mfschunkserver.cfg.dist mfschunkserver.cfg; cp mfshdd.cfg.dist mfshdd.cfg
    No need to do this on dedicated masters if they are not going to be used as chunkservers. More information on mfschunkserver.cfg is available in 'man mfschunkserver.cfg' file.
  12. Edit file 'mfshdd.cfg' and enter mount points where data for mfs filesystem can be stored. For example if we have two dedicated physical partitions /dev/sda2, /dev/sda3 that we have created for mooseFS and we have mounted them on /mnt/data1 and /mnt/data2. Then specify /mnt/data1 and /mnt/data2 (one on each line) in 'mfshdd.cfg' file.
    Do this only on chunkservers. It is recommended that dedicated partitions are used for mooseFS so that free space calculations can be done properly.
  13. Use 'chown -R mfs:mfs <mount_point> on all mount points so that user mfs has write access to them. This needs to be done only on chunkservers.
  14. Use 'service mfschunkserver start; chkconfig mfschunkserver on' on chunkserver.
  15. Configure all mfschunkserver using steps mentioned above. Do not follow steps that are meant for mfsmaster or mfs metalogger server on dedicated chunk servers. It is very important that /etc/hosts is used to point to proper mfsmaster servers' IP address.

Mounting mooseFS filesystem

  1. Ensure that /etc/hosts points to correct mfsmaster server.
  2. Create directory /mnt/mfs where we can mount mfs partition.
  3. Use command mfsmount /mnt/mfs -H mfsmaster -p to mount mfs partition on /mnt/mfs folder.
    Refer to 'man mfsmount' for more information on mfsmount command. For example we can use -S to mount a subfolder of mfs server rather than mounting entire mfs filesystem.

Controlling replication

By defaults only one copy of each file / folder is stored. To increase replication we can use commands 'mfssetgoal' and 'mfsgetgoal' For example if we want three copies of folder '</mnt/mfs/x86_64' along with three copies of all sub-folders and files then we can use:

mfssetgoal -r 3 /mnt/mfs/x86_64

We can check the current goal / replication value using

mfsgetgoal /mnt/mfs/x86_64

Stopping mooseFS

In order to safely stop the MooseFS cluster you have to do the following steps:

  1. Unmount the file system on all machines using umount command (in our examples it would be: umount /mnt/mfs)
  2. Stop the chunk server processes - 'service mfschunkserver stop'
  3. Stop the metalogger process - 'service mfsmetalogger stop'
  4. Stop the master server process - 'service mfsmaster stop'

Recovering files

  1. To recover files special file system mfsmeta needs to be mounted on some directory. Use command 'mfsmount -o mfsmeta' with other arguments same as normal mounting to mount mfsmeta system.
  2. Directory named trash has all deleted files. If we move any file from trash to folder named 'undel' inside trash then file is restored provided no other file with same name exists on existing moosefs filesystem.


Firewall consideration

  • Firewall was disabled on machines when above steps were used. With iptables enable incoming connectoins port 9422 on all chunkserver. Enable incoming connections to ports 9419-9421 on master server and meta logger server.
  • Port 9425 needs to be allowed on master server for HTTP access for monitoring interface

Removing disks

  • We can mark partitions or disks for removal by preceding there names with asterisk('*') and then restarting chunkserver. We can use HTTP CGI interface to ensure that all chunks from those disks have been removed and then safely remove those disks.