Gagan | Rohith | Sunil
“ MongoDB (from "hu mongo us") is a scalable, high-performance, open source, schema-free, document-oriented data...
Features   <ul><li>Document Oriented Storage </li></ul><ul><li>Querying </li></ul><ul><li>Auto Sharding </li></ul><ul><li>...
Document oriented storage <ul><li>Document 1: FirstName=“raj&quot;, Address=“bogadi&quot;, Hobby=“stamp collection&quot; <...
 
 
Querying <ul><li>Collections == Tables </li></ul><ul><li>Documents/objects == Records/rows </li></ul>
SQL Statement  Mongo Query Language Statement  CREATE TABLE USERS (a Number, b Number); implicit; can be done  explicitly ...
DEMO (Part 1)
Sharding Sharding is the partitioning of data among multiple machines in an  order-preserving manner . SHARDING IN MONGODB...
 
Architectural Overview
Operations <ul><li>The config server => Meta-data </li></ul><ul><li>The mongos process =>Routing &  Coordination </li></ul...
Config server Mongos Shards
Architectural Overview
Operation Types <ul><li>Operations on a sharded system fall into one of two categories. </li></ul><ul><li>global   </li></...
Flowchart App  Server Client (Mongos) Configuration Server DECISION Global Targeted Shard3 Shard4 Shard2 Shard1
Sharding and Failover NO SINGLE POINT FAILURE Failure of ->Mongos process ->Single mongod server ->Failure of all mongod s...
Master and Slave
REPLICA SETS Shards Architecture Representation
Replication Set
A Set
A Set
A Set
A Set
Election Algorithm Periodically exchange  Maxappliedoptime  with all other nodes using the following format (selfid,maxopt...
Election Algorithm(Flow) server-a: primary oplog: (a1,a2,a3,a4,a5) server-b: secondary oplog: (a1) server-c: secondary opl...
DEMO
BIBLOGRAPHY <ul><li>Www.mongodb.org </li></ul><ul><li>Snails in Turtleneck.com </li></ul>
Upcoming SlideShare
Loading in …5
×

Mongodb

1,632 views
1,497 views

Published on

best viewed in ubuntu (openoffice )

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,632
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
36
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mongodb

  1. 1. Gagan | Rohith | Sunil
  2. 2. “ MongoDB (from &quot;hu mongo us&quot;) is a scalable, high-performance, open source, schema-free, document-oriented database.” - mongodb.org Created by 10gen
  3. 3. Features <ul><li>Document Oriented Storage </li></ul><ul><li>Querying </li></ul><ul><li>Auto Sharding </li></ul><ul><li>Replication Set </li></ul>
  4. 4. Document oriented storage <ul><li>Document 1: FirstName=“raj&quot;, Address=“bogadi&quot;, Hobby=“stamp collection&quot; </li></ul><ul><li>Document 2: FirstName=“raghu&quot;, Address=“25, kuvempu nagar&quot;, Children=(“ram,10&quot;, “hari,8&quot;, “ramya,5”) </li></ul><ul><li>BSON </li></ul><ul><li>JSON </li></ul><ul><li>JSON Notation </li></ul><ul><li>db.people.insert({FirstName:’raj’,Address=‘bogadi’,Hobby=‘stamp collection’}) </li></ul>
  5. 7. Querying <ul><li>Collections == Tables </li></ul><ul><li>Documents/objects == Records/rows </li></ul>
  6. 8. SQL Statement  Mongo Query Language Statement  CREATE TABLE USERS (a Number, b Number); implicit; can be done  explicitly  INSERT INTO USERS VALUES(1,1); db.users.insert({a:1,b:1}) SELECT * FROM users; db.users.find() SELECT * FROM users WHERE age=33; db.users.find({age:33}) SELECT * FROM users WHERE age=33 ORDER BY name; db.users.find({age:33}).sort({name:1}) SELECT * FROM users WHERE age>33; db.users.find({'age':{$gt:33}}) SELECT * FROM users WHERE age<33; db.users.find({'age':{$lt:33}})
  7. 9. DEMO (Part 1)
  8. 10. Sharding Sharding is the partitioning of data among multiple machines in an order-preserving manner . SHARDING IN MONGODB: Auto –Sharding (only needs shard key ). Automatic load Balancing. Scaling out to thousands of nodes. Availability and automated failover
  9. 12. Architectural Overview
  10. 13. Operations <ul><li>The config server => Meta-data </li></ul><ul><li>The mongos process =>Routing & Coordination </li></ul><ul><li>Mongod=> Mongo Demon(Mysqld) </li></ul>
  11. 14. Config server Mongos Shards
  12. 15. Architectural Overview
  13. 16. Operation Types <ul><li>Operations on a sharded system fall into one of two categories. </li></ul><ul><li>global </li></ul><ul><li>Targeted </li></ul><ul><li>db.foo.find( { x : 300, age : 40 } ) (Targeted) db.foo.find( { age : 40 } ) (Global) </li></ul>
  14. 17. Flowchart App Server Client (Mongos) Configuration Server DECISION Global Targeted Shard3 Shard4 Shard2 Shard1
  15. 18. Sharding and Failover NO SINGLE POINT FAILURE Failure of ->Mongos process ->Single mongod server ->Failure of all mongod servers comprising a shard. ->Config server.
  16. 19. Master and Slave
  17. 20. REPLICA SETS Shards Architecture Representation
  18. 21. Replication Set
  19. 22. A Set
  20. 23. A Set
  21. 24. A Set
  22. 25. A Set
  23. 26. Election Algorithm Periodically exchange Maxappliedoptime with all other nodes using the following format (selfid,maxoptime) . If nodes maxoptime is more send NO or else send YES(Arbitrer). The node getting the majority of yes and see majority of nodes will be elected as Primary . The process is repeated periodically.
  24. 27. Election Algorithm(Flow) server-a: primary oplog: (a1,a2,a3,a4,a5) server-b: secondary oplog: (a1) server-c: secondary oplog: (a1,a2,a3) … // server-a goes down … server-b: secondary oplog: (a1) server-c: secondary oplog: (a1,a2,a3) ... server-b: secondary oplog: (a1) server-c: primary oplog: (a1,a2,a3) // c has highest ord and becomes primary ... server-b: secondary oplog: (a1,a2,a3) server-c: primary oplog: (a1,a2,a3,c4) ... server-a resumes ... server-a: recovering oplog: (a1,a2,a3,a4,a5) server-b: secondary oplog: (a1,a2,a3) server-c: primary oplog: (a1,a2,a3,c4) … server-a: recovering oplog: (a1,a2,a3,c4) server-b: secondary oplog: (a1,a2,a3,c4) server-c: primary oplog: (a1,a2,a3,c4) … server-a: secondary oplog: (a1,a2,a3,c4) server-b: secondary oplog: (a1,a2,a3,c4) server-c: primary oplog: (a1,a2,a3,c4,c5,c6,c7,c8) … server-a: secondary oplog: (a1,a2,a3,c4,c5,c6,c7,c8) server-b: secondary oplog: (a1,a2,a3,c4,c5,c6,c7,c8) server-c: primary oplog: (a1,a2,a3,c4,c5,c6,c7,c8)
  25. 28. DEMO
  26. 29. BIBLOGRAPHY <ul><li>Www.mongodb.org </li></ul><ul><li>Snails in Turtleneck.com </li></ul>

×