# Mogilefs-1.0.1

**URL:** <https://www.ruby-forum.com/t/mogilefs-1-0-1/85479>\
**Category:** Ruby\
**Created:** [March 22, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/mogilefs-1-0-1/85479 "2006-03-22T20:24:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![miracleofmagick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@miracleofmagick](https://www.ruby-forum.com/u/miracleofmagick)\
**Post date:** [March 22, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/mogilefs-1-0-1/85479/1 "2006-03-22T20:24:30Z")

</div>

Rubyforge Project:

[http://rubyforge.org/projects/rctools/](http://rubyforge.org/projects/rctools/)

Documentation:

[http://dev.robotcoop.com/Libraries/mogilefs/](http://dev.robotcoop.com/Libraries/mogilefs/)

== About

This is a client for Danga’s MogileFS distributed file system. For  
information  
on MogileFS see:

> **[mogilefs](https://github.com/mogilefs/)**
>
> mogilefs has 6 repositories available. Follow their code on GitHub.

== Installing mogilefs

First you need a MogileFS setup. You can find information on how to  
do that at the above URL.

Then install the gem:

$ sudo gem install mogilefs

== Using mogilefs

# Create a new instance that will communicate with these trackers:

hosts = %w[192.168.1.69:6001 192.168.1.70:6001]  
mg = MogileFS::MogileFS.new(:domain =\> ‘test’, :hosts =\> hosts  
:root =\> ‘/mnt/mogilefs’)

# Stores “A bunch of text to store” into ‘some\_key’ with a class

of ‘text’.  
mg.store\_content ‘some\_key’, ‘text’, “A bunch of text to store”

# Retrieve data from ‘some\_key’

data = mg.get\_file\_data ‘some\_key’

# Store the contents of ‘image.jpeg’ into the key ‘my\_image’ with

a class of

# ‘image’.

mg.store\_file ‘my\_image’, ‘image’, ‘image.jpeg’

# Store the contents of ‘image.jpeg’ into the key ‘my\_image’ with

a class of

# ‘image’ using an open IO.

File.open ‘image.jpeg’ do |fp|  
mg.store\_file ‘my\_image’, ‘image’, fp  
end

# Remove the key ‘my\_image’ and ‘some\_key’.

mg.delete ‘my\_image’  
mg.delete ‘some\_key’

== WARNING!

This client is only known to work in NFS mode. HTTP mode is  
implemented but  
completely untested. If you find a bug, please report it on the  
Rubyforge  
project:

[http://rubyforge.org/tracker/?func=add&group\_id=1266&atid=4981](http://rubyforge.org/tracker/?func=add&group_id=1266&atid=4981)

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![miracleofmagick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71c47a/32.png) [@miracleofmagick](https://www.ruby-forum.com/u/miracleofmagick)\
**Post date:** [March 22, 2006, 8:35pm UTC](https://www.ruby-forum.com/t/mogilefs-1-0-1/85479/2 "2006-03-22T20:35:18Z")

</div>

Awesome Eric Thanks!

-Ezra
