brief overview of nosql & mongodb for gtug tbilisi event

21
NoSQL Ioseb Dzmanashvili Lead Architect @ Picktek Teacher @ Caucasus School of Technology Monday, April 2, 2012

Upload: azry-llc-caucasus-school-of-technology

Post on 18-May-2015

789 views

Category:

Technology


1 download

DESCRIPTION

Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

TRANSCRIPT

Page 1: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

NoSQL

Ioseb DzmanashviliLead Architect @ PicktekTeacher @ Caucasus School of Technology

Monday, April 2, 2012

Page 2: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Monday, April 2, 2012

Page 3: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

It actually means: Not Only SQL

Monday, April 2, 2012

Page 4: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

MongoDBCouchDBRedisNeo4jCassandra

MySqlOracleM$SQL

PostgreSQLSQLite

NoSQL SQL

Monday, April 2, 2012

Page 5: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

NoSQL Kinds

•Document Oriented

•Key Value Oriented

•Graph Oriented

• ...

•Something else Oriented

Monday, April 2, 2012

Page 6: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Other NoSQL Characteristics

•No Relational Structures

•No JOIN Queries

•No Schema

•No Complex Transactions

Monday, April 2, 2012

Page 7: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

MongoDB

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

© MongoDB

Monday, April 2, 2012

Page 8: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Page 9: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Flexible Structure

Monday, April 2, 2012

Page 10: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Page 11: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Flexible Structurevar comment = { name: "john doe", email: "[email protected]", comment: "NoSQL Rulez!!!"};

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

Monday, April 2, 2012

Page 12: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Flexible Structure

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

Monday, April 2, 2012

Page 13: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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: "[email protected]", ...} ]}

Monday, April 2, 2012

Page 14: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Page 15: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Replica Sets

•Asynchronous master/slave replication

•Automatic failover

•Automatic recovery

•Consists of two or more nodes

•Automatic primary node election

Monday, April 2, 2012

Page 16: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

...Replica Sets

Member 2 Member 1

Member 3Primary

ClientRead/Write

Read

Monday, April 2, 2012

Page 17: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Page 18: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

...Replica Sets Arbiter

Member 2ArbiterNo Data Member 1

Member 3Primary ClientRead/Write

Read

Monday, April 2, 2012

Page 19: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

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

Page 20: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Questions?

Monday, April 2, 2012

Page 21: Brief overview of NoSQL & MongoDB for GTUG Tbilisi Event

Thank You!

Monday, April 2, 2012