Saturday, 26 January 2013

MongoDB is an open source document-oriented database system developed and supported by 10gen. It is part of the NoSQL family of database systems. Instead of storing data in tables as is done in a "classical" relational database, MongoDB stores structured data as JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster.

Main Features


  • Ad hoc queries
  • Indexing
  • Replication
  • Load balancing
  • File storage
  • Aggregation (GROUP BY clause)
  • Server-side JavaScript execution
  • Capped collections (Fixed Size Collections)

Architecture




Pros


  • Schema-less: If you have a flexible schema, this is ideal for a document store like MongoDB. This is difficult to implement in a performant manner in RDBMS.
  • Ease of Scale-Out: Scale reads by using replica sets. Scale writes by using sharding (auto balancing). Just fire up another machine and away you go. Adding more machines = adding more RAM over which to distribute your working set.
  • Cost: Depends on which RDBMS of course, but MongoDB is free and can run on Linux, ideal for running on cheaper commodity kit.
  • you can choose what level of consistency you want depending on the value of the data (e.g. faster performance = fire and forget inserts to MongoDB, slower performance = wait till insert has been replicated to multiple nodes before returning).

Cons


  • Data size in MongoDB is typically higher due to e.g. each document has field names stored it
  • Less flexibity with querying (e.g. no JOINs)
  • No support for transactions - certain atomic operations are supported, at a single document level.
  • At the moment Map/Reduce (e.g. to do aggregations/data analysis) is OK, but not intensively fast. So if that's required, something like Hadoop may need to be added into the mix.
  • Less up to date information available/fast evolving product.

Who Uses MongoDB?


  • AppScale
  • Barclays
  • Bitly
  • Business Insider
  • CERN Large Hadron Collider
  • Craigslist
  • Diaspora
  • Disney Interactive Media Group
  • Etsy
  • foursquare
  • Globo.com
  • MTV Networks
  • MOG Technologies
  • Qiqqa
  • Shutterfly
  • SourceForge
  • The Guardian
  • The New York Times
  • Thumbtack
  • Uber
  • Wordnik

Configuring MongoDB on Ubuntu


Step 1) Add 10gen package to source.list
The 10gen package contains the latest mongoDB version, append below line to the end of the file “/etc/apt/sources.list”

deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen

Step 2) Update Package

$  sudo apt-get update

Step 3) Add GPG Key for 10gen Package

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10

Step 4) Install mongodb-10gen

$ sudo apt-get install mongodb-10gen

Step 5) Verification

$ mongo
MongoDB shell version: 1.8.1
connecting to: test
>


Step6) MongoDB Java Tutorial - http://www.mongodb.org/display/DOCS/Java+Tutorial

0 comments:

Post a Comment

Find me on Facebook! Follow me on Twitter!