== MogileFS on Debain 5.02 64bit [client] | | -------------------------------- | | | | 192.168.0.10 | 192.168.0.21 192.168.0.22 [Database] | [tracker1] [trakcer2] | | --------------------------------- | | | 192.168.0.31 192.168.0.32 192.168.0.33 [Stored1] [stored2] [stored3] = on Dtabase server > aptitude -y install mysql-server > mysqladmin -u root -p password "" = on all server > aptitude -y install perl libcompress-zlib-perl libio-stringy-perl libstring-crc32-perl libwww-perl debhelper dpkg-dev fakeroot perl -MCPAN -e "install BSD::Resource" perl -MCPAN -e "install Net::Netmask" perl -MCPAN -e "install Sys::Syscall" perl -MCPAN -e "install Danga::Socket" perl -MCPAN -e "install Linux::AIO" perl -MCPAN -e "install IO::AIO" perl -MCPAN -e "install MogileFS::Client" perl -MCPAN -e "install DBI" perl -MCPAN -e "install Gearman::Server" perl -MCPAN -e "install Gearman::Client" perl -MCPAN -e "install Gearman::Client::Async" perl -MCPAN -e "install Perlbal" > svn co http://code.sixapart.com/svn/mogilefs/trunk > cd trunk/server > perl Makefile.PL > make > make test > sudo make install > cd ../api/perl/MogileFS-Client > perl Makefile.PL > make > make test > sudo make install > cd ../../../utils > perl Makefile.PL > make > make test > sudo make install > cd ../ > useradd -s /bin/false mogile == On Database server > vim /etc/mysql/my.cnf bind-address = 0.0.0.0 > /etc/init.d/mysql restart > mogdbsetup --dbuser=mogile --dbpass=mogpass --yes == Configure mogile on Tracker server > mkdir /etc/mogilefs > cp server/conf/* /etc/mogilefs > vim /etc/mogilefs/mogilefsd.conf #daemonize = 1 db_dsn = DBI:mysql:mogilefs:host=192.168.0.10 db_user = mogile db_pass = mogpass listen = 0.0.0.0:7001 conf_port = 7001 listener_jobs = 10 delete_jobs = 1 replicate_jobs = 5 mog_root = /mnt/mogilefs reaper_jobs = 1 = Run tracker > sudo -u mogile mogilefsd == Configure mogstored on stored server > mkdir /var/mogdata > /etc/mogilefs/mogstored.conf ## HTTP Request httplisten = 0.0.0.0:7500 ## Perlbal mgmtlisten = 0.0.0.0:7501 ## Document Root docroot = /var/mogdata = on stored1 server > mkdir /var/mogdata > cd /var/mogdata > mkdir dev1 = on stored2 server > mkdir /var/mogdata > cd /var/mogdata > mkdir dev2 = on stored3 server > mkdir /var/mogdata > cd /var/mogdata > mkdir dev3 = run mogstored on each stored server > mogstored -d = add host from server has mogadm command. > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host add 192.168.0.31 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host add 192.168.0.32 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host add 192.168.0.33 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host list = create device > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device add 192.168.0.31 1 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device add 192.168.0.32 2 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device add 192.168.0.33 3 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device list = create domain > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" domain add jun.com > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" class add jun.com normal --mindevcount=2 > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" domain list domain class mindevcount -------------------- -------------------- ------------- jun.com default 2 jun.com normal 2 = enable > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device mark 192.168.0.31 1 alive > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device mark 192.168.0.32 2 alive > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device mark 192.168.0.33 3 alive > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host mark 192.168.0.31 alive > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host mark 192.168.0.32 alive > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host mark 192.168.0.33 alive > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" device list > mogadm --trackers="192.168.0.21:7001,192.168.0.22:7001" host list == Test Script > vim mogileTest.pl #!/usr/bin/perl use strict; use warnings; use MogileFS::Client; ## MogileFS Instance my $mogfs = MogileFS::Client->new( domain => 'jun', hosts => [ '192.168.0.21:7001' ], ); die "Unable to initialize MogileFS object." unless $mogfs; ## The file that key name is "hello". Normal class my $fh = $mogfs->new_file("hello", "normal") or die $mogfs->errstr; ## Write $fh->print("Hello, MogileFS!!") or die $mogfs->errstr; ## AClose $fh->close or die $mogfs->errstr; ## Read the file that key name is hello my $data = $mogfs->get_file_data("hello"); die $mogfs->errstr unless $data; print $$data . "\n"; > perl mogileTest.pl = check one of stored server > ls -al /var/mogdata/*/*/*/*/* -rw-r--r-- 1 root root 17 2009-08-07 16:36 /var/mogdata/dev1/0/000/000/0000000002.fid = cehck another stored server. > ls -al /var/mogdata/*/*/*/*/* -rw-r--r-- 1 root root 17 2009-08-07 16:36 /var/mogdata/dev2/0/000/000/0000000002.fid > mysql -u mogile -pmogpass mogilefs mysql> select * from file; +-----+------+--------+--------+---------+----------+ | fid | dmid | dkey | length | classid | devcount | +-----+------+--------+--------+---------+----------+ | 6 | 1 | hello | 17 | 1 | 2 | | 7 | 1 | hello2 | 18 | 1 | 2 | | 8 | 1 | hello3 | 18 | 1 | 2 | +-----+------+--------+--------+---------+----------+ 3 rows in set (0.00 sec) 1 row in set (0.00 sec) mysql> select * from file_on; +-----+-------+ | fid | devid | +-----+-------+ | 6 | 1 | | 8 | 1 | | 7 | 2 | | 8 | 2 | | 6 | 3 | | 7 | 3 | +-----+-------+ 6 rows in set (0.00 sec) == memo mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" check mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host add 216.69.70.75 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host add 216.69.70.76 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host add 216.69.70.77 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host list mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device add 216.69.70.75 1 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device add 216.69.70.76 2 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device add 216.69.70.77 3 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device list mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" domain add jun.com mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" class add jun.com normal --mindevcount=2 mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" domain list mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device mark 216.69.70.75 1 alive mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device mark 216.69.70.76 2 alive mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device mark 216.69.70.77 3 alive mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host mark 216.69.70.75 alive mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host mark 216.69.70.76 alive mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host mark 216.69.70.77 alive mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" device list mogadm --trackers="216.69.70.84:7001,216.69.70.85:7001" host list