MongoDB: Replication,Sharding,MapReduce
Upcoming SlideShare
Loading in...5
×
 

MongoDB: Replication,Sharding,MapReduce

on

  • 3,861 views

 

Statistics

Views

Total Views
3,861
Views on SlideShare
3,849
Embed Views
12

Actions

Likes
9
Downloads
74
Comments
0

4 Embeds 12

http://paper.li 7
http://twitter.com 2
http://us-w1.rockmelt.com 2
https://duckduckgo.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

MongoDB: Replication,Sharding,MapReduce MongoDB: Replication,Sharding,MapReduce Presentation Transcript

  • { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), "binary" : BinData(0,""), "string" : "abc", "number" : 3, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3], "dbref" : [_id1, _id2, _id3] padding}
  • { db.coll.find({"string": "abc"});db.coll.find({ "string" : /^a.*$/i }); "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), db.coll.find({"subobj.subA": 1}); db.coll.find({"subobj.subB": {$exists: true} }); "binary" : BinData(0,""), "string" : "abc", db.coll.find({"number": 3}); db.coll.find({"number": {$gt: 1}}); "number" : 3, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3], db.coll.find({"array": {$all:[1, 2]} }); "dbref" : [_id1, _id2, _id3] db.coll.find({"array": {$in:[2, 4, 6]} }); padding}
  • { "_id" : ObjectId("4dcd3ebc9278000000005158"), "timestamp" : ISODate("2011-05-13T14:22:46.777Z"), { $set : {"string": "def"} } "binary" : BinData(0,""), { $inc : {"number": 1} } "string" : "def", { $pull : {"subobj": {"subB": 2 } } } "number" : 4, "subobj" : {"subA": 1, "subB": 2 }, "array" : [1, 2, 3, 4, 5, 6], "dbref"$addToSet : { "array" : { $each : [ 4 , 5 , 6 ] } } } { : [_id1, _id2, _id3] "newkey" : "In-place"} { $set : {"newkey": "In-place"} }
  • Member1 Member2Primary SecondaryMember4 Member3Secondary Secondary
  • Member1 Member2Primary SecondaryMember4 Member3Secondary Secondary
  • Member1 Member2Primary SecondaryMember4 Member3Secondary Secondary
  • Member2 SecondaryMember4 Member3Secondary Secondary
  • Member1 PrimaryMember6 Member2Secondary SecondaryMember5 Member3Secondary Secondary Member4 Secondary
  • Member1 PrimaryMember6 Member2Secondary SecondaryMember5 Member3Secondary Secondary Member4 Secondary
  • Member1 PrimaryMember6 Member2Secondary SecondaryMember5 Member3Secondary Secondary Member4 Secondary
  • Chunk Shard Key Chunk 200MB
  • Cluster Shard Servers (Data) config Servers (Shard Configration) shard1 shard2 shard3 [ a, f ) [ k, n) [ o, t ) Chunk [ f, k ) [ n, o ) [ t, } ) mongos Servers (Routers)
  • http://www.mongodb.org/display/DOCS/Introduction
  • primary Shard primary 1 ( mongosprimary primary primary ) Shardcinfig Shard mongos http://www.mongodb.org/display/DOCS/Introduction
  • shard1 shard2[ a, f ) [ n, o ) [ o, t) [ 0, 9)[ f, k ) [ k, n) shard1 shard2[ a, f ) [ o, t) [ n, o )[ f, k ) [ k, n) [ 0, 9)
  • m = function(){ this.tags.forEach{ function(z) { emit(z, {count: 1}); } };};r = function(key, values) { var total=0; for (i=0, i<values.length, i++) total += values[i].count; return { count : total };}res=db.things.mapReduce(m,!r);# finalize