Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Post on 18-May-2015

791 views 1 download

Tags:

description

Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

transcript

NoSQL

Ioseb DzmanashviliLead Architect @ PicktekTeacher @ Caucasus School of Technology

Monday, April 2, 2012

NoSQL is a ill-defined and volatile field© Martin Fowler

Monday, April 2, 2012

It actually means: Not Only SQL

Monday, April 2, 2012

MongoDBCouchDBRedisNeo4jCassandra

MySqlOracleM$SQL

PostgreSQLSQLite

NoSQL SQL

Monday, April 2, 2012

NoSQL Kinds

•Document Oriented

•Key Value Oriented

•Graph Oriented

• ...

•Something else Oriented

Monday, April 2, 2012

Other NoSQL Characteristics

•No Relational Structures

•No JOIN Queries

•No Schema

•No Complex Transactions

Monday, April 2, 2012

MongoDB

open-source, high-performance, document-oriented database

© MongoDB

Monday, April 2, 2012

Why MongoDB?

It is not the strongest of the species that survives, nor the most intelligent. It is the one that is most adaptable to change.

© Charles Darwin

Monday, April 2, 2012

db.blogposts.insert({ name: "ioseb", date: "2012-04-01", title: "NoSQL Sucks", summary: "Yes it Sucks", content: "..."});

Flexible Structure

Monday, April 2, 2012

Flexible Structuredb.blogposts.update({ name: "ioseb" }, { name: "ioseb", date: "2012-04-01", title: "NoSQL is Cool!", summary: "Yes it's Cool!", content: "...", tags: [ "nosql", "sql" ] });

Monday, April 2, 2012

Flexible Structurevar comment = { name: "john doe", email: "john@doe.com", comment: "NoSQL Rulez!!!"};

db.blogposts.update({ name: "ioseb" }, { $push: { comments: comment } });

Monday, April 2, 2012

Flexible Structure

var post = db.blogposts.find( {name: "ioseb"});

Monday, April 2, 2012

Flexible Structure{ name: "ioseb", date: "2012-04-01", title: "NoSQL is Cool!", summary: "Yes it's Cool!", content: "...", tags: [ "nosql", "sql" ], comments: [ {author: "john", email: "john@doe.com", ...} ]}

Monday, April 2, 2012

Flexible Indexing// index by namedb.blogposts.ensureIndex( {name: true});

// index by tags arraydb.blogposts.ensureIndex( {tags: true});

// index by comments authorsdb.blogposts.ensureIndex( {"comments.author": true});

Monday, April 2, 2012

Replica Sets

•Asynchronous master/slave replication

•Automatic failover

•Automatic recovery

•Consists of two or more nodes

•Automatic primary node election

Monday, April 2, 2012

...Replica Sets

Member 2 Member 1

Member 3Primary

ClientRead/Write

Read

Monday, April 2, 2012

Easy Configuration

config = {_id: 'GTUG', members: [ {_id: 0, host: 'localhost:27017'}, {_id: 1, host: 'localhost:27018'}, {_id: 2, host: 'localhost:27019'}]}

rs.initiate(config);

Monday, April 2, 2012

...Replica Sets Arbiter

Member 2ArbiterNo Data Member 1

Member 3Primary ClientRead/Write

Read

Monday, April 2, 2012

Easy Configuration

config = {_id: 'GTUG', members: [ {_id: 0, host: 'localhost:27017'}, {_id: 1, host: 'localhost:27018'}, {_id: 2, host: 'localhost:27019', arbiterOnly: true}]}

rs.initiate(config);

Monday, April 2, 2012

Questions?

Monday, April 2, 2012

Thank You!

Monday, April 2, 2012