MongoDB is an open source database that is very scalable and high performing, and is fast becoming one of the more popular NoSql implementations. It uses a data format known as BSON, which is syntactically similar JSON but is saved in binary form for speed; is schema free, meaning that documents belonging to the same store need not necessarily have the same structure; and can store dates, object ids, binary data, regular expressions and code as well as the basic JSON types of string, integer, boolean, double, null, array and object.

Installing Mongo is really simple:

  • create a mongo file (not necessary but tidy) [mkdir /mongo]
  • pull mongo [curl http://downloads.mongodb.org/linux/mongodb-linux-x86_64-{{VERSION}}.tgz > mongo.tgz]
  • extract [tar xzf mongo.tgz]
  • create data file [mkdir -p /data/db/]
  • install [chown id -u /data/db]

Next install mongodb-php:

  • install dev tools (if necessary) [yum groupinstall "Developer Tools"]
  • check whether pecl needs upgrading (it did for me) and check mongo package available [pecl search mongo]
  • install [pecl install mongo] (if any problems, try creating mongo directory in /tmp)
  • restart apache [apachectl graceful]

If you’re anything like me, you’ll prefer a half-decent administration ui over the command line. I originally looked at phpMoAdmin, but for whatever reason it would die, giving me an HTTP 500 error when it did so but with no further guidance, every other time I accessed it (including navigating from page to page…). Even when it did work it looked awful and didn’t seem very friendly, so I gave up on that and installed RockMongo.

RockMongo was super simple to install – just a matter of cloning the respository onto the root of my server – and tweak the config if necessary (for me the defaults worked fine). The only problem that I had was that I couldn’t work out how to change the default username/password from admin/admin. It’s really easy though, was probably more to do with me being tired than it being complicated: simply change the line

$MONGO["servers"][$i]["control_users"]["admin"] = "admin";

to

$MONGO["servers"][$i]["control_users"][{{username}}] = {{password}};

in the config.php

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks

Leave a reply

required

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>