3. What is MongoDB?
MongoDB is a scalable, high-performance, open-source,
schema-free, document-oriented database developed by
10gen.
- MongoDB is named from "huMONGOus," meaning "extremely large".
4. Features
• Dynamic schemas
• Full, flexible index support and rich queries
• Sharding for horizontal scalability
• Replication for high availability
• Text search
• Advanced security
• Aggregation Framework and Map-Reduce
• GridFS
• Geospatial
16. Application Concerns
• Write Concern
o Errors Ignored
o Unacknowledge
o Acknowledged (default)
o Journaled
o Replica Acknowledged
• Read Preferences
o primary
o primaryPreferred
o secondary
o secondaryPreferred
o nearest
19. Replica Set as a Shard
Add each replica set as a shard
> sh.addShard( "set01/myhost1.net:27017, myhost2.net:
27017,myhost3.net:27017" )
To add standalone server as a shard.. DON’T DO IT!!
> sh.addShard( "myhost9.net:27017" )
20.
21.
22. Selecting Shard Key
• Distribution of Data
• Hashed Shard Key
• Chunks and Balancing
23. Enable Sharding
You must enable sharding on each database separately
> sh.enableSharding("mydatabase")
And for each collection
> sh.shardCollection( "mydatabase.mycol", { "userId" : 1 } )