February 18 2010

Remote Resolution of Git Conflicts

You are attempting to push when you experience a conflict:

[ksedgwic@lap2 bonsai-wiki]$ git push
To ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki.git
 ! [rejected]        master -> master (non-fast forward)
error: failed to push some refs to 'ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki.git'

First, see if the conflict can be automatically resolved:

[ksedgwic@lap2 bonsai-wiki]$ git pull
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki
   fe30702..b52b62c  master     -> origin/master
Auto-merged howtos/vcs/git_conflict.mdwn
CONFLICT (content): Merge conflict in howtos/vcs/git_conflict.mdwn
Automatic merge failed; fix conflicts and then commit the result.

Git status shows that your state is conflicted:

[ksedgwic@lap2 bonsai-wiki]$ git status
howtos/vcs/git_conflict.mdwn: needs merge
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 1 and 1 different commit(s) each, respectively.
#
# Changed but not updated:
#   (use "git add ..." to update what will be committed)
#
#       unmerged:   howtos/vcs/git_conflict.mdwn
#
no changes added to commit (use "git add" and/or "git commit -a")

IMPORTANT - If you can resolve the conflict do so (normal procedure), this procedure presumes you wish to write the conflicting updates to a branch.

Reset your tree to just your unmerged updates:

[ksedgwic@lap2 vcs]$ git reset --hard HEAD
HEAD is now at e1497e3 Changed title.

Create a branch, use a name which suggests a conflict:

[ksedgwic@lap2 vcs]$ git branch master-conflict-20090125
[ksedgwic@lap2 vcs]$ git branch
* master
  master-conflict-20090125

Reset your tree to the prior revision:

[ksedgwic@lap2 vcs]$ git reset --hard HEAD^
HEAD is now at fe30702 started test for creating dual headed branches upon push

Pull the other persons changes:

[ksedgwic@lap2 vcs]$ git pull

Switch back to your branch:

[ksedgwic@lap2 vcs]$ git checkout master-conflict-20090125
Switched to branch "master-conflict-20090125"

Push your conflict branch back to the repoistory:

[ksedgwic@lap2 vcs]$ git push origin master-conflict-20090125
Counting objects: 9, done.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 406 bytes, done.
Total 5 (delta 3), reused 0 (delta 0)
To ssh://ikiwiki@git.bonsai.com/~/public_git/bonsai-wiki.git
 * [new branch]      master-conflict-20090125 -> master-conflict-20090125
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0)
From /home/ikiwiki/public_git/bonsai-wiki
 * [new branch]      master-conflict-20090125 -> origin/master-conflict-20090125

complete reference : http://www.bonsai.com/wiki/howtos/vcs/git_remote_resolve/

February 09 2010

Ruby on Rails simple tutorials

http://www.tutorialspoint.com/ruby-on-rails/index.htm

February 09 2010

Simple CSS Menu

This is just for future reference ;=)
<html>
	<head>
		<title>CSS based drop-down menu</title>
	<style type="text/css">

		ul {
			font-family: Arial, Verdana;
			font-size: 14px;
			margin: 0;
			padding: 0;
			list-style: none;
		}
		ul li {
			display: block;
			position: relative;
			float: left;
		}
		li ul { display: none; }
		ul li a {
			display: block;
			text-decoration: none;
			color: #ffffff;
			border-top: 1px solid #ffffff;
			padding: 5px 15px 5px 15px;
			background: #2C5463;
			margin-left: 1px;
			white-space: nowrap;
		}

		ul li a:hover { background: #617F8A; }
		li:hover ul {
			display: block;
			position: absolute;
		}
		li:hover li {
			float: none;
			font-size: 11px;
		}
		li:hover a { background: #617F8A; }
		li:hover li a:hover { background: #95A9B1; }

	</style>
	</head>
	<body>

		<ul id="menu">
			<li><a href="">Home</a></li>
		    <li><a href="">About</a>
		      <ul>
		      	<li><a href="">The Team</a></li>
		        <li><a href="">History</a></li>
		        <li><a href="">Vision</a></li>
		      </ul>
		    </li>
		    <li><a href="">Products</a>
		      <ul>
		        <li><a href="">Cozy Couch</a></li>
		        <li><a href="">Great Table</a></li>
		        <li><a href="">Small Chair</a></li>
		        <li><a href="">Shiny Shelf</a></li>
		        <li><a href="">Invisible Nothing</a></li>
		      </ul>
		    </li>
		    <li><a href="">Contact</a>
		      <ul>
		        <li><a href="">Online</a></li>
		        <li><a href="">Right Here</a></li>
		        <li><a href="">Somewhere Else</a></li>
		      </ul>
		    </li>
		</ul>	

	</body>
</html>

https://www.servage.net/blog/2009/03/20/create-a-cool-css-based-drop-down-menu/

enjoy :-p

January 15 2010

How To Deploy Your Rails Application With Phusion Passenger - Site5

Finally, I have found the way to setup my rails application using Phusion Passenger at Site5 hosting.

It works for me! hope this will a stable one.

Visit this link: http://wiki.site5.com/Scripting_and_Development_Guide#Ruby_on_Rails

Yey!

November 03 2009

How to type special characters in MAC

Wondering how to type the letter “ñ” in MAC? Well here’s the link :)

enjoy!  ->   http://watchingapple.com/2007/08/tip-how-to-type-a-tilde/

April 22 2009

What is DNS?

The Domain Name System (DNS) is a hierarchical naming system for computers, services, or any resource participating in the Internet. It associates various information with domain names assigned to such participants. Most importantly, it translates domain names meaningful to humans into the numerical (binary) identifiers associated with networking equipment for the purpose of locating and addressing these devices world-wide. An often used analogy to explain the Domain Name System is that it serves as the “phone book” for the Internet by translating human-friendly computer hostnames into IP addresses. For example, www.example.com translates to 208.77.188.166.

The Domain Name System makes it possible to assign domain names to groups of Internet users in a meaningful way, independent of each user’s physical location. Because of this, World-Wide Web (WWW) hyperlinks and Internet contact information can remain consistent and constant even if the current Internet routing arrangements change or the participant uses a mobile device. Internet domain names are easier to remember than IP addresses such as 208.77.188.166 (IPv4) or 2001:db8:1f70::999:de8:7648:6e8 (IPv6). People take advantage of this when they recite meaningful URLs and e-mail addresses without having to know how the machine will actually locate them.

The Domain Name System distributes the responsibility of assigning domain names and mapping those names to IP addresses by designating authoritative name servers for each domain. Authoritative name servers are assigned to be responsible for their particular domains, and in turn can assign other authoritative name servers for their sub-domains. This mechanism has made the DNS distributed, fault tolerant, and helped avoid the need for a single central register to be continually consulted and updated.

In general, the Domain Name System also stores other types of information, such as the list of mail servers that accept email for a given Internet domain. By providing a world-wide, distributed keyword-based redirection service, the Domain Name System is an essential component of the functionality of the Internet.

Other identifiers such as RFID tags, UPC codes, International characters in email addresses and host names, and a variety of other identifiers could all potentially utilize DNS [1].

The Domain Name System also defines the technical underpinnings of the functionality of this database service. For this purpose it defines the DNS protocol, a detailed specification of the data structures and communication exchanges used in DNS, as part of the Internet Protocol Suite (TCP/IP). The DNS protocol was developed and defined in the early 1980s and published by the Internet Engineering Task Force (cf. History).

March 21 2009

Mac OS X keyboard shortcuts

Startup
Keystroke Description
Press X during startup Force Mac OS X startup
Press Option-Command-Shift-Delete
during startup
Bypass primary startup volume and seek a different startup volume (such as a CD or external disk)
Press C during startup Start up from a CD that has a system folder
Press N during startup Attempt to start up from a compatible network server (NetBoot)
Press T during startup Start up in FireWire Target Disk mode
Press Shift during startup start up in Safe Boot mode and temporarily disable login items and non-essential kernel extension files (Mac OS X 10.2 and later)
Press Command-V during startup Start up in Verbose mode.
Press Command-S during startup Start up in Single-User mode
Finder window
Keyboard shortcut Description
Command-W Close Window
Option-Command-W Close all Windows
Command-Right Arrow Expand folder (list view)
Option-Command-Right Arrow Expand folder and nested subfolders (list view)
Command-Left Arrow Collapse Folder (list view)
Option-Command-Up Arrow Open parent folder and close current window
(Assigned in Keyboard & Mouse preferences) Show Package Contents (of selected file in Mac OS X 10.5 or later only). To create this contextual menu shortcut, open Keyboard & Mouse preferences in Mac OS X 10.5, click Keyboard Shortcuts, click the “+” button, choose Finder.app as the Application, and type “Show Package Contents” (exactly), and set whichever shortcut you want, such as Command-Control-S.
Menu commands
Keyboard shortcut Description
Shift-Command-Q Apple Menu
Log out
Shift-Option-Command-Q Apple Menu
Log out immediately
Shift-Command-Delete Finder Menu
Empty Trash
Option-Shift-Command-Delete Finder Menu
Empty Trash without dialog
Command-H Finder Menu
Hide Finder
Option-Command-H Finder Menu
Hide Others
Command-N File Menu
New Finder window
Shift-Command-N File Menu
New Folder
Command-O File Menu
Open
Command-S File Menu
Save
Shift-Command-S File Menu
Save as
Command-P File Menu
Print
Command-W File Menu
Close Window
Option-Command-W File Menu
Close all Windows
Command-I File Menu
Get Info
Option-Command-I File Menu
Show Attributes Inspector
Command-D File Menu
Duplicate
Command-L File Menu
Make Alias
Command-R File Menu
Show original
Command-T File Menu
Add to Favorites (Mac OS X 10.2.8 or earlier), Add to Sidebar (Mac OS X 10.3 or later—use Shift-Command-T for Add to Favorites)
Command-Delete File Menu
Move to Trash
Command-E File Menu
Eject
Command-F File Menu
Find
Command-Z Edit Menu
Undo
Command-X Edit Menu
Cut
Command-C Edit Menu
Copy
Command-V Edit Menu
Paste
Command-A Edit Menu
Select All
Command-1 View Menu
View as Icons
Command-2 View Menu
View as List
Command-3 View Menu
View as Columns
Command-B View Menu
Hide Toolbar
Command-J View Menu
Show View Options
Command - [ Go Menu
Back
Command - ] Go Menu
Forward
Shift-Command-C Go Menu
Computer
Shift-Command-H Go Menu
Home
Shift-Command-I Go Menu
iDisk
Shift-Command-A Go Menu
Applications
Shift-Command-F Go Menu
Favorites
Shift-Command-G Go Menu
Goto Folder
Command-K Go Menu
Connect to Server
Command-M Window Menu
Minimize Window
Option-Command-M Window Menu
Minimize All Windows
Command-? Help Menu
Open Mac Help
Command-Space Open Spotlight (Mac OS X 10.4 or later)
Command-esc Front Row
Activates Front Row for certain Apple computers
Universal Access and VoiceOver
Keyboard shortcut Description
Option-Command-8 Turn on Zoom
Option-Command-+ (plus) Zoom in
Option-Command– (minus) Zoom out
Control-Option-Command-8 Switch to White on Black
Control-F1 Turn on Full Keyboard Access
When Full Keyboard Access is turned on, you can use the key combinations listed in the table below from the Finder.
Control-F2 Full Keyboard Access
Highlight Menu
Control-F3 Full Keyboard Access
Highlight Dock
Control-F4 Full Keyboard Access
Highlight Window (active) or next window behind it
Control-F5 Full Keyboard Access
Highlight Toolbar
Control-F6 Full Keyboard Access
Highlight Utility window (palette)
Command-F5 or fn-Command-F5 Turn VoiceOver on or off (Mac OS X 10.4 or later)
Control-Option-F8 or fn-Control-Option-F8 Open VoiceOver Utility (Mac OS X 10.4 or later)
Control-Option-F7 or fn-Control-option-F7 Display VoiceOver menu (Mac OS X 10.4 or later)
Control-Option-;
or fn-Control-option-;
Enable/disable VoiceOver Control-Option lock (Mac OS X 10.4 or later)

The Universal Access preference pane allows you to turn on Mouse Keys. When Mouse Keys is on, you can use the numeric keypad to move the mouse. If your computer doesn’t have a numeric keypad, use the Fn (function) key.

Mouse Keys
Keystroke Description
8 Move Up
2 Move Down
4 Move Left
6 Move Right
1, 3, 7, and 9 Move Diagonally
5 Press Mouse Button
0 Hold Mouse Button
. (period on keypad) Release Mouse Button (use after pressing 0)
Other Commands
Keystroke Description
Option-Command-D Show/Hide Dock
Command-Tab Switch application
tab Highlight next item
Command-Up Arrow Move up one directory
Command-Down Arrow Move down one directory
Page Up or Control-Up Arrow Move up one page
Page Down or Control-Down Arrow Move down one page
Option-Drag Copy to new location
Option-Command-Drag Make alias in new location
Command-Drag Move to new location without copying
Shift-Command-C Show Colors palette in application
Command-T Show Font palette in application
Command-Shift-3 Take a picture of the screen
Command-Shift-4 Take a picture of the selection
Command-Shift-4, then press Control while selecting Take a picture of the screen, place in Clipboard
Command-Shift-4, then Spacebar Take a picture of the selected window
Option-Command-esc Force Quit
Control-Eject Restart, Sleep, Shutdown dialog box
Control-Command-Eject Quit all applications and restart
Option-Command-Eject or
Option-Command-Power
Sleep
Command-click window toolbar button (upper right corner) Cycle through available views for the window’s toolbar (dependant on the nature of the Finder or application window)
Command-` Cycle through windows in application or Finder (if more than one window is open)
Function-Delete (portables only–PowerBook, iBook, MacBook, MacBook Pro) Forward Delete (delete the character to the right of your cursor)

February 10 2009

How To Setup MogileFS

Version: 0.03, July 3, 2006

Author: Brett G. Durrett (first name at last name dot net)

Source: http://durrett.net/mogilefs_setup.html

Overview

This document explains how to setup and configure a basic MogileFS installation. It is intended for the novice systems administrator and should enable anybody with the skills to install a basic Linux distro to get MogileFS up and running on it.

I am going to assume you have three roles for this setup. A machine should be able to handle more than one role. I will use hosts mogiledb.yourdomain.com, mogiletracker.yourdomain.com and mogilestorage.yourdomain.com \u2013 rename these to meet your needs.
Getting MogileFS

If you look around you can find MogileFS directly on the Danga website, in an abandoned CVS repository and in the current SVN repository. If you pull from the website you will not have admin tools to make setup easier. If you pull from CVS you will have a version from October, 2004. If you pull from SVN you will have a shiny new version that works best with this documentation.

Using svn (http://subversion.tigris.org/), checkout the latest and greatest version (the example below pulls from the trunk).

$ mkdir mogilefs-src
$ cd mogilefs-src
$ svn checkout http://code.sixapart.com/svn/mogilefs/trunk

Installation
Creating a Database

Setting up a MySQL server is beyond the scope of this document \u2013 there are packages available for most distributions, find one that suits your needs. Once you have a MySQL server up and running on host mogiledb.yourdomain.com, create a table and user for MogileFS. Some libraries don’t play well with new MySQL passwords \u2013 if you use these, set the password using the \u201cOLD_PASSWORD\u201d function. Make sure you change the password to something better than the example.

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

You will also need to create the schema \u2013 that is covered later in this document.

Setting up the Trackers and Storage Servers

You need to obtain and install the MogileFS-specific perl modules and their dependencies before MogileFS will install successfully. Hopefully you pulled the MogileFS source from the SVN repository \u2013 if so, the server components will be located in the trunk/server directory. You probably need to install dependent modules first (see below) but once all dependencies have been met, you can install Mogile with the following commands (starting in the top of the SVN directory you pulled):

# cd trunk/server/
# perl Makefile.PL
# make
# make test
# make install

If you get any errors during this process it will probably be errors telling you that a dependent module is missing. If during the ‘make test’ step you get the error, “t/00-startup….DBI connect(’mysql’,'root’,…) failed: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) at t/lib/mogtestlib.pl line 16″ it can probably be ignored \u2013 it should not be necessary for MySQL to be running on any host other than mogiledb.yourdomain.com.

You probably want to install some helpful utilities on each tracker or storage server as well (these will be needed for later configuration). These are located in the trunk/utils directory and can be installed with the following commands (starting in the top of the SVN directory you pulled):

# cd trunk/utils/
# perl Makefile.PL
# make
# make test
# make install

You also want the API \u2013 the utilities will require this. These are located in the trunk/api/perl directory and can be installed with the following commands (starting in the top of the SVN directory you pulled):

# cd trunk/api/perl
# perl Makefile.PL
# make
# make test
# make install

Installing Perl Module Dependencies

As for Perl modules, you need (at least) Perlbal and Danga-Socket and any dependencies. If you are not sure how to locate the dependent modules, consider using CPAN (http://cpan.org/) as it can install a module and all of the dependencies. If you already have a reasonable Perl installation you probably have most of the non-MogileFS modules already.

The basic process for installing most perl modules is:

extract the module:

# tar -xvzf Linux-AIO-1.9.tar.gz

Create the makefile:

# cd Linux-AIO-1.9
# perl Makefile.PL

Build the code:

# make

Test the code (some modules may not have this step but it is okay to run anyway):

# make test

Install it:

# make install

If you see any errors stating that a module dependency is missing, obtain and install the missing module first and try again.
Setup
Database Configuration

The database is empty and will need a schema applied. The ‘ trunk/server’ directory has a utility named ‘mogdbsetup’ to make this process simple. By default it assumes the database is located on localhost so if you are running it from a different host you will need to provide the host name on the command line.

# ./mogdbsetup –dbhost=mogiledb.yourdomain.com –dbname=mogilefs –dbuser=mogile –dbpassword=sekrit

Again, make sure you replace the host and password so that they match you database configuration from above.

The mogdbsetup utility does not specify a table type by default so your tables will match the defaults for your database. In many cases this will mean that you end up with MyISAM tables. If you prefer InnoDB tables you will either need to make sure your database defaults to InnoDB or you can manually convert the tables (both of these are outside of the scope of this document but there are plenty of examples out there).

Tracker Configuration

On each tracker server (mogiletracker.yourdomain.com), create a configuration file at /etc/mogilefs/mogilefsd.conf with the following:

db_dsn DBI:mysql:mogilefs:mogiledb.yourdomain.com
db_user mogile
db_pass sekrit
conf_port 6001
listener_jobs 5

db_dsn points to your database instance. If you are running the database on the same machine as the storage server you can omit “:mogiledb.yourdomain.com: and it will use the local machine. db_user and db_pass should match the user and password you configured when setting up your database.

The program ‘mogilefsd’ will not run as root so you will need to run this as a non-root user. To create a user for this, enter the following command and follow the prompts to create the “mogile” user:

# adduser mogile

In order to use the tools to setup the storage servers you will need to have the trackers running. Refer to “Starting Trackers”, below.

Storage Server Configuration

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

# mkdir /var/mogdata

Configure it:

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

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

Use ‘mogadm’ to add each storage server to the database. This requires that the trackers are already running so if you have not already started them, refer to “Starting Trackers”, below. You need to supply the Perl lib path which has the ‘MogileFS.pm’ perl module installed \u2013 this was installed if you installed the API in the “Setting up the Trackers and Storage Servers” section above. The following example would add the host mogilestorage.yourdomain.com as a storage server, assuming that mogilestorage.yourdomain.com had an IP address of 192.168.42.3 (listening on port 7500) and your tracker had an IP address of 192.168.42.1 (listening on port 6001):

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001 host add mogilestorage –ip=192.168.42.3 –port=7500 –status=alive

You can confirm that your host(s) were added with the following command;

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001 host list

You also need to add devices for each storage host. If you don’t provide a device id mogadm is supposed to do it for you… in practice I find it dies with an error, so you will need to manually add a unique device id after the host:

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001 device add mogilestorage 1

Finally, add the correctly-name device (folder) to each storage host. I have been unable to get the tools to handle this well, so I am probably doing something wrong. As a workaround, I used the modadm device list command to see what device names were assigned and then I added the folders to my storage hosts. Run the following command:

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001 device list

It will list each host and the device name followed by its status and storage available. Here is example output:

mogilestorage [1]: alive
used(G) free(G) total(G)
dev1: alive 0.892 67.772 68.664

This means “mogilestorage” has a host id of “1″ and it has one device named “dev1″ on it and that device is in the “alive” state (your other statistics will probably be zeros). Using the example output above, you would simply create the directory on mogilestorage.yourdomain.com:

# mkdir -p /vag/mogdata/dev1

Finally, confirm your devices are configured:

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001 device list

Running MogileFS

Starting Storage Servers

Start each storage server (mogilestorage.yourdomain.com) by running the following command as root:

# mogstored –daemon

Starting Trackers

Trackers will not run as root so you will need to run them as another user. If you created the “mogile” user when seetingup the trackers, the following commands will work (assumes you start logged in to mogiletracker.yourdomain.com as root):

# su mogile
$ mogilefsd -c /etc/mogilefs/mogilefsd.conf –daemon
$ exit

You can confirm that the trackers are running with the following command:

# ps aux | grep mogilefsd

If you don’t get a list of running processes the trackers are not running.
Try It

Do a Quick Sanity Test

The ‘mogadm’ tool can be used to make sure your trackers are functioning. You need to supply the Perl lib path which has the ‘MogileFS.pm’ perl module installed \u2013 this was installed if you installed the API in the “Setting up the Trackers and Storage Servers” section above. The following example would check all mogile components using the trackers at IP address 192.168.42.1 and 192.168.42.2, both listening on port 6001:

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001,192.168.42.2:6001 check

Try it with Real Data

Create a domain:

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001,192.168.42.2:6001 domain add testdomain

Add a class to the domain:

# mogadm –lib=/usr/local/share/perl/5.8.4 –trackers=192.168.42.1:6001,192.168.42.2:6001 class add testdomain testclass

Troubleshooting

This section is still very incomplete.  Let me know if you have other common problems that need to be added.

When I run mogadm I get “Unable to retrieve host information from tracker(s)”:

mogadm requires the tarckers to be running before it is run.

When starting the storage daemon I get “ERROR: Directory not found for service mogstored”:

You did not create a storage directory or you are starting the mogstored as a user that does not have access to the directory.

Problems Connecting:

Make sure your firewall is open. Using the examples in this document, port 7500 and 7501 needed on storage servers, 6001 on trackers.

While testing I get \u201cMogileFS::Backend: couldn’t connect to mogilefsd backend at /usr/local/share/perl/5.8.4/MogileFS.pm line 56\u201d:

Make sure your tracker connects to the database:

# su mogile
$ mogilefsd -c /etc/mogilefs/mogilefsd.conf

I get a “REQUEST FAILURE” on “Checking devices…” when doing a mogadm check:

Confirm the devices (folders) exist in the /var/mogdata directory and that the use running the mogstored process has full permissions to these directories. If the device does not exist, add it \u2013 it will take a few seconds for mogadm check to reflect the fixed directory. For example, if mogilestorage.yourdomain.com had the device “dev1″ on it, you would add the directory:

# mkdir -p /vag/mogdata/dev1

Document Revision History

2006-07-03 Version 0.03 Brett G. Durrett: highlighted need to start trackers before using mogadm (and added troubleshooting reference), formatting changes.
2006-06-26 Version 0.02 Brett G. Durrett: minor typo corrections and fixed characters trashed in converting document to html
2006-06-25 Version 0.01 Brett G. Durrett: created initial document

==========================================================

//From: http://www.danga.com/mogilefs/usage.bml
Using MogileFS

Using the provided Perl API, here are some examples of how to create the MogileFS object and then to create a new file within MogileFS, how to delete a file, and how to get a file out of MogileFS and to determine where the file is.

An example snippet to create a MogileFS object:

use MogileFS;
my $mogfs = MogileFS->new(domain => ‘domain_name’,
hosts  => [ '10.1.0.11:6001' ],
# only on NFS/disk based installations
root   => ‘/var/mogdata’,);
die “Unable to initialize MogileFS object.\n” unless $mogfs;

Once you have a MogileFS object, it’s easy to create new files and stick them in the system:

my $fh = $mogfs->new_file(”file_key”, “file_class”);
die “Unable to allocate filehandle.\n” unless $fh;
$fh->print($file_contents);
die “Unable to save file to MogileFS.\n” unless $fh->close;

That’s the simplest way to save a file. Make sure to check the return value of the close function to make sure that it is non-zero.

To get a file’s contents easily, use this code:

my $file_contents = $mogfs->get_file_data(”file_key”);

Deleting a file is just as simple:

die “Unable to delete file.\n” unless
$mogfs->delete(”file_key”);

If you want to get access to an actual representation of the file, you can also ask for the paths to the file. This function will return either an actual filesystem path if you’re using an NFS/disk based system or a URL. For example:

my @paths = $mogfs->get_paths(”file_key”, $no_verify);

Of note is the second parameter. If set to a true value, this instructs MogileFS not to verify the validity of the first path before returning. If your code is going to verify the data you get back anyway, you might as well set this to true so that you get the paths much faster.

Those are the basics of using the MogileFS client library. This documentation will be expanded as needed.

Source: http://www.maycode.com/index.php/hotspot/35-linux/827-how-to-setup-mogilefs.html