|
NAMEmogtool -- Inject/extract data to/from a MogileFS installationWARNING: this utility is deprecated! See MogileFS::Utils SYNOPSIS$ mogtool [general-opts] <command> [command-opts] <command-args> $ mogtool --trackers=127.0.0.1:6001 --domain=foo --class=bar ... $ mogtool --conf=foo.conf ... $ mogtool inject thefile.tgz thefilekey $ mogtool inject --bigfile thebigfile.tgz thefilekey $ mogtool inject --bigfile --gzip thebigfile.tar thefilekey $ mogtool inject --bigfile --gzip mydirectory thedirkey $ mogtool inject --bigfile --gzip /dev/hda4 thedevkey $ mogtool inject --nobigfile bigcontiguousfile bigcfilekey $ mogtool inject --bigfile --gzip --verify \ --description="Description" \ --receipt="foo@bar.com, baz@bar.com" \ --concurrent=5 --chunksize=32M \ somehugefile thefilekey $ mogtool extract thefilekey thenewfile.tgz $ mogtool extract thefilekey - $ mogtool extract --bigfile thedirkey . $ mogtool extract --bigfile --asfile thedirkey thefile.tgz $ mogtool extract --bigfile thedevkey /dev/hda4 $ mogtool delete thekey $ mogtool locate --noverify thekey $ mogtool locate --bigfile thekey $ mogtool list $ mogtool listkey key GENERAL OPTIONS
COMMANDS
INJECT OPTIONSThe following options are used to control the behavior of the injector.
INJECT ARGUMENTS
EXTRACT OPTIONS
EXTRACT ARGUMENTS
DELETE OPTIONS
DELETE ARGUMENTS
LOCATE OPTIONS
LOCATE ARGUMENTS
RETURN VALUES
USAGE EXAMPLESPlease note that all examples assume you have a default config file that contains the tracker and domain to use. Saves us from having to clutter up the command line.Small Files (<64MB)When it comes to using small files, mogtool is very, very easy.Injection $ mogtool inject foo.dbm foo.dbm.2004.12 Injects the file foo.dbm into MogileFS under the key of foo.dbm.2004.12. $ mogtool inject --gzip foo.dbm foo.dbm.2004.12 Injects the same file to the same key, but compresses it on the fly for you. Extraction $ mogtool extract foo.dbm.2004.12 newfoo.dbm Retrieves the key foo.dbm.2004.12 and saves it as newfoo.dbm. $ mogtool extract --gzip foo.dbm.2004.12 newfoo.dbm Gets the file and automatically decompresses it, if and only if it was compressed. So basically, you can turn on gzip in your config file and mogtool will do the smart thing each time. $ mogtool extract foo.dbm.2004.12 - Print the resource to standard out. If you want, you can pipe it somewhere or redirect to a file (but why not just specify the filename?). Large Files (>64MB)Given mogtool's ability to break files into chunks and later reassemble them, inserting large files (even files over the 4GB barrier) is relatively easy.Injection $ mogtool inject --bigfile largefile.dat largefile.dat As expected, inserts the file largefile.dat into the MogileFS system under the name largefile.dat. Not very creative. Uses the default 64MB chunks. $ mogtool inject --bigfile --chunksize=16M largefile.dat largefile.dat Specify to use 16MB chunks instead of the default. Otherwise, the same. $ mogtool inject --bigfile --chunksize=1000K --gzip largefile.dat somekey Do it again, but specify 1000KB chunks, gzip automatically, and upload it under a different key somekey. $ mogtool inject --bigfile --concurrent=5 --gzip largefile.dat somekey Same as above, but use 5 children processes for uploading chunks to MogileFS. This can take up to 300MB of memory in this example! (It tends to use about (concurrency + 1) * chunksize bytes.) $ mogtool inject --bigfile --chunksize=32M --concurrent=3 --gzip \ --receipt="foo@bar.com" --verify --description="A large file" \ largefile.dat somekey Break this file into 128MB chunks, set a description, use 3 children to upload them, gzip the file as you go, do a full MD5 verification of every chunk, then email a receipt with all of the MogileFS paths to me. Lots of flexibility with mogtool. Extraction $ mogtool extract --bigfile somekey newfile.dat In its basic form, extracts the previously inserted large file and saves it as newfile.dat. $ mogtool extract --bigfile --gzip somekey newfile.dat If the file was gzipped on entry, ungzip it and save the result. If it wasn't gzipped, then we just save it. DirectoriesDirectories are easily injected and extracted with mogtool. To create the data stream that is inserted into MogileFS, we use tar.Injection $ mogtool inject --bigfile mydir mykey Run mydir through tar and then save it as mykey. $ mogtool inject --bigfile --gzip --concurrent=5 mydir mykey Inject, but also gzip and use multiple injectors. Note how this is just like injecting a large file. See injection examples for large files for more examples. Extraction $ mogtool extract --bigfile mykey . Extract the previously injected directory mykey to your local directory. $ mogtool extract --bigfile --asfile mykey foo.tar Take the previously generated tarball and save it as foo.tar. Simply creates the file instead of extracting everything inside. Partitions/Devicesmogtool has the ability to inject raw partitions into MogileFS and to retrieve them later and write them back to a partition. They're treated just like directories for the most part, we just don't pipe things through tar.Injection $ mogtool inject --bigfile /dev/hda3 hda3.backup Save a raw copy of your partition /dev/hda3 to the key hda3.backup. $ mogtool inject --bigfile --gzip /dev/hda3 hda3.backup Same, but compress on the fly during injection. Extraction $ mogtool extract --bigfile hda3.backup /dev/hda4 Extract the partition at hda3.backup to the partition /dev/hda4. WARNING: mogtool won't ask for confirmation, make sure you don't mistype partition numbers! Deleting a ResourceWARNING: Please make sure you're specifying the right parameter, as delete does not prompt for confirmation of the request!$ mogtool delete thekey Delete a normal file. $ mogtool delete --bigfile thekey Delete a chunked file--this deletes all chunks and the receipt, so the file is gone. Listing Big Files$ mogtool list backup Lists all large files stored in MogileFS. It is not possible to list all normal files at this time. Listing Files Matching a Key$ mogtool listkey abc1 Lists all files in MogileFS whose keys start with the characters "abc1". CONFIGURATION FILEInstead of adding a ton of options to the command line every time, mogtool enables you to create a default configuration file that it will read all of the options from. It searches two locations for a default configuration file: ~/.mogtool and /etc/mogilefs/mogtool.conf. (Alternately, you can specify --conf=whatever as an option on the command line.)The file can consist of any number of the following items: trackers = 10.0.0.3:7001, 10.10.0.5/10.0.0.5:7001 domain = mogiledomain class = fileclass lib = /home/foo/lib gzip = 1 big = 1 overwrite = 1 chunksize = 32M receipt = foo@bar.com, baz@bar.com verify = 1 concurrent = 3 KNOWN BUGSNone? Send me any you find! :)PLANNED FEATURES
AUTHORMark Smith <junior@danga.com> - most of the implementation and maintenance.Brad Fitzpatrick <brad@danga.com> - concepts and rough draft. Robin H. Johnson <robbat2@orbis-terrarum.net> - locate function. Copyright (c) 2002-2004 Danga Interactive. All rights reserved. POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |