Setting Up MogileFS

MogileFS Installation

This installation has been tested with RHEL 5.2 x86_64, the same procedure may work with other distributions as well.

Prerequisites

1. You need aleast two machines to configure MogilesFS, in one machine we have configured the DB, tracker and storage, other machine has only tracker and storage

2. Install elinks and ncftp-client, these are the prerequisite for cpan. In this installation we have used cpan to install the prerequisites.

The elinks packages is being shipped with RHEL by default. If you have installed RHEL with minimal package set you need to install it using rpm or yum.

The ncftp-client can be downloaded from the follwoing location.

http://www.ncftp.com/download/


 * 1) tar -jxvf ncftp-3.2.2-src.tar.bz2
 * 2) cd ncftp-3.2.2
 * 3) ./configure
 * 4) make
 * 5) make install
 * 6) ldconfig

3. Configure cpan, if you are using it for the first time.


 * 1) cpan (follow theinstaructios, for first time only)

4. Install the following perl modules.


 * 1) cpan install IO::AIO
 * 2) cpan install Linux::AIO
 * 3) cpan install ExtUtils::MakeMaker
 * 4) cpan install Danga::Socket
 * 5) cpan install Gearman::Client
 * 6) cpan install Gearman::Server
 * 7) cpan install Gearman::Client::Async
 * 8) cpan install Net::Netmask
 * 9) cpan install Perlbal
 * 10) cpan install Sys::Syscall
 * 11) cpan install MogileFS::Client
 * 12) cpan install DBD::mysql

5. Install mogilefs-utils

Do an svn export/checkout to get the latest version of the utils


 * 1) svn export http://code.sixapart.com/svn/mogilefs/trunk/utils mogilefs-utils
 * 2) perl Makefile.PL
 * 3) make
 * 4) make test
 * 5) make install

Install MogileFS Server

1. Download the latest stable release of MogileFS Server package from cpan web site.

http://cpan.oss.eznetsols.org/authors/id/D/DO/DORMANDO/


 * 1) tar -jxvf mogilefs-server-2.20.tar.gz
 * 2) cd mogilefs-server-2.20
 * 3) perl Makefile.PL
 * 4) make
 * 5) make test
 * 6) make install

2. Install MogileFS APIs, required for the utils

Do an svn export/checkout to get the latest version of the APIs


 * 1) svn checkout http://code.sixapart.com/svn/mogilefs/trunk/api/perl/mogilefs-api
 * 2) perl Makefile.PL
 * 3) make
 * 4) make install

NOTE: There are two sub-directories inside this directory and you need to install both of them.

Install MySQL Server

1. MySQL is beeing shipped with RHEL by default, use rpm or yum to install the same. You can also setup multi master replication for better redundancy in the DB level

2. Crate the database for MogileFS

mysql> CREATE DATABASE mogilefs; mysql> GRANT ALL ON mogilefs.* TO 'mogile'@'%'; mysql> SET PASSWORD FOR 'mogile'@'%' = OLD_PASSWORD( 'sekrit' ); mysql> FLUSH PRIVILEGES; mysql> quit
 * 1) mysql

3. Database Configuration

The database which we have created is empty and will need a schema applied.


 * 1) mogdbsetup --dbhost=192.168.32.25 --dbname=mogilefs --dbuser=mogile --dbpassword=sekrit

Configure the tracker

1. On each tracker server create a configuration file at /etc/mogilefs/mogilefsd.conf with the following entries.

db_dsn = DBI:mysql:mogilefs:192.168.32.25 db_user = mogile db_pass = sekrit listen = 0.0.0.0:6001 conf_port = 6001 listener_jobs = 10 delete_jobs = 1 replicate_jobs = 5 mog_root = /var/mogdata reaper_jobs = 1

9. The tracker deamon won't work as root, so create a user for mogilefsd


 * 1) adduser mogile

10. Starting Trackers

$ mogilefsd -c /etc/mogilefs/mogilefsd.conf --daemon $ exit
 * 1) su mogile

Storage Node Configuration

1. On each storage server, create the storage directory (make sure it has access permissions for the user you will use to run mogstored):


 * 1) mkdir /var/mogdata

2. On each storage server, create a configuration file at /etc/mogilefs/mogstored.conf with the following:

maxconns = 10000 httplisten = 0.0.0.0:7500 mgmtlisten = 0.0.0.0:7501 docroot = /var/mogdata

Configuring mogadm

1. Create a configuration file at /etc/mogilefs/mogilefs.conf with the following

trackers = 192.168.32.25:6001, 192.168.32.26:6001

Configuring mogtool

1. Create a configuration file at /etc/mogilefs/mogtool.conf with the following entries

trackers = 192.168.32.25:6001, 192.168.32.26:6001 domain = testdomain class = testdata lib = /usr/lib/perl5/vendor_perl/5.8.8/ overwrite = 1 chunksize = 32M receipt = admin@bigmaps.com verify = 1 concurrent = 3

Adding Storage nodes and devices

1. Use the following command to add the storage hosts.


 * 1) mogadm host add mogilestorage1 --ip=192.168.32.25 --port=7500 --status=alive
 * 2) mogadm host add mogilestorage2 --ip=192.168.32.27 --port=7500 --status=alive

2. Verify this by using following command


 * 1) mogadm host list

3. Adding Device for the Storage host


 * 1) mogadm device add mogilestorage1 1
 * 2) mogadm device add mogilestorage2 2

NOTE: Device ID should be unique, verify this by using following command


 * 1) mogadm device list

4. Create Device directory on all Storage Servers.


 * 1) mkdir -p /var/mogdata/dev1
 * 2) mkdir -p /var/mogdata/dev1

5. Start Storage Server

mogstored --daemon

Testing

1. Create a domain:


 * 1) mogadm domain add testdomain

2. Add a class to the domain:


 * 1) mogadm class add testdomain testclass

3. Use modtool for adding and retriving the data.


 * 1) mogtool inject file-name key-name
 * 2) mogtool extract key-name file-name

for large files, >64M


 * 1) mogtool inject --bigfile file-name key-name
 * 2) mogtool extract --bigfile key-name file-name

for directories


 * 1) mogtool inject --bigfile dir-name key-name
 * 2) mogtool extract --bigfile dir-name file-name