8
MongoDB Replica Sets & Sharding

MongoDB

Embed Size (px)

Citation preview

Page 1: MongoDB

MongoDB

Replica Sets & Sharding

Page 2: MongoDB

TODO

• Replica Sets

• Sharding

• Aggregation Framework

Page 3: MongoDB

Replica Sets

m1 m2 m3

m4 m5 m6

rs0

rs1

High Availability

Page 4: MongoDB

Primary / Slave

m1

m2 m3

Primary

SlaveSlave

Single primary Async

Page 5: MongoDB

Replica Set Conf{ "_id" : "rs0", "version" : 3, "members" : [ { "_id" : 0, "host" : "m1.mongo.gsgate.ru:27017" }, { "_id" : 1, "host" : "m2.mongo.gsgate.ru:27017" }, { "_id" : 2, "host" : "m3.mongo.gsgate.ru:27017" } ] }

Page 6: MongoDB

Sharding

• Shard Key

• Range-based partitioning / “Big Tables”

• Chunk (split, mirgate)

Page 7: MongoDB

Sharding

rs0 rs1

config-servers mongos

Page 8: MongoDB

Aggregation Framework

• Project • Match • Limit • Skip • Unwind • Group • Sort • geoNear