Your SlideShare is downloading. ×
0
MongoDBIntroduction to MongoDB
Harun YardımcıSoftware Architect @ eBay@nosqlcozumler
What is MongoDB?MongoDB is a scalable, high-performance, open-source,schema-free, document-oriented database developed by1...
Features•  Dynamic schemas•  Full, flexible index support and rich queries•  Sharding for horizontal scalability•  Replica...
TerminologyRDBMS MongoDBTable CollectionRow DocumentIndex IndexJoin Embedded DocumentForeign Key ReferencePartition ShardD...
NoSQL Databases
Document Database•  What is a document?o  PDF, Word document, text file?Document is an associated array
Deployment Architecture•  Standalone•  Replica Set•  Sharded ClusterStandalone < Replica Set < Sharded Cluster** Typical s...
CAP TheoremAvailabilityConsistencyPartitionToleranceN/ACAAPCPOracleMySQLPostgresMongoDBBigTableHBaseRedisMemcacheCouchDBCa...
Standalone$ mongod--dbpath /data/db--fork--logappend--logpath /var/log/mongod.log--journal--port 27017
Configuration Filevim /etc/mongod.confdbpath = /data/dbfork = truelogappend = truelogpath = /var/log/mongodb.logjournal = ...
ReplicationRedundancy, Backup, and Automatic Failover•  Master / Slave (Deprecated since 1.6)•  Replica Set
Replica Set$ mongod--dbpath /data/db--fork--logappend--logpath /var/log/mongod.log--journal--port 27017--replSet set01
Replica Set InitializationStartup mongod process and connect to one of them> var cnf = { _id : set01, members : [{ _id : 0...
Replica Set•  Majority•  Voting•  Arbiters•  Hidden Members•  Delayed Members
Application Concerns•  Write Concerno  Errors Ignoredo  Unacknowledgeo  Acknowledged (default)o  Journaledo  Replica Ackno...
Sharding•  Why?•  Scale-out•  Store different part of data on different hosts•  Auto Balancing
Sharding Components•  Shardso  Standaloneo  Replica Set•  Config Servers•  Mongos
Replica Set as a ShardAdd each replica set as a shard> sh.addShard( "set01/myhost1.net:27017, myhost2.net:27017,myhost3.ne...
Selecting Shard Key•  Distribution of Data•  Hashed Shard Key•  Chunks and Balancing
Enable ShardingYou must enable sharding on each database separately> sh.enableSharding("mydatabase")And for each collectio...
ThanksIf you have any questions, please feel free to ask
Introduction to Mongodb
Introduction to Mongodb
Upcoming SlideShare
Loading in...5
×

Introduction to Mongodb

4,858

Published on

Introduction to MongoDB

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,858
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
41
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Introduction to Mongodb"

  1. 1. MongoDBIntroduction to MongoDB
  2. 2. Harun YardımcıSoftware Architect @ eBay@nosqlcozumler
  3. 3. What is MongoDB?MongoDB is a scalable, high-performance, open-source,schema-free, document-oriented database developed by10gen.- MongoDB is named from "huMONGOus," meaning "extremely large".
  4. 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
  5. 5. TerminologyRDBMS MongoDBTable CollectionRow DocumentIndex IndexJoin Embedded DocumentForeign Key ReferencePartition ShardDatabase Database
  6. 6. NoSQL Databases
  7. 7. Document Database•  What is a document?o  PDF, Word document, text file?Document is an associated array
  8. 8. Deployment Architecture•  Standalone•  Replica Set•  Sharded ClusterStandalone < Replica Set < Sharded Cluster** Typical sharded cluster consist of replica sets in production.
  9. 9. CAP TheoremAvailabilityConsistencyPartitionToleranceN/ACAAPCPOracleMySQLPostgresMongoDBBigTableHBaseRedisMemcacheCouchDBCassandraRiakDynamoSimpleDB
  10. 10. Standalone$ mongod--dbpath /data/db--fork--logappend--logpath /var/log/mongod.log--journal--port 27017
  11. 11. Configuration Filevim /etc/mongod.confdbpath = /data/dbfork = truelogappend = truelogpath = /var/log/mongodb.logjournal = trueport = 27017$ mongod --config /etc/mongod.conf
  12. 12. ReplicationRedundancy, Backup, and Automatic Failover•  Master / Slave (Deprecated since 1.6)•  Replica Set
  13. 13. Replica Set$ mongod--dbpath /data/db--fork--logappend--logpath /var/log/mongod.log--journal--port 27017--replSet set01
  14. 14. Replica Set InitializationStartup mongod process and connect to one of them> var cnf = { _id : set01, members : [{ _id : 0, host: myhost1.net:27017 },{ _id : 1, host: myhost2.net:27017 },{ _id : 2, host: myhost3.net:27017 }]}> rs.initiate(cnf)
  15. 15. Replica Set•  Majority•  Voting•  Arbiters•  Hidden Members•  Delayed Members
  16. 16. Application Concerns•  Write Concerno  Errors Ignoredo  Unacknowledgeo  Acknowledged (default)o  Journaledo  Replica Acknowledged•  Read Preferenceso  primaryo  primaryPreferredo  secondaryo  secondaryPreferredo  nearest
  17. 17. Sharding•  Why?•  Scale-out•  Store different part of data on different hosts•  Auto Balancing
  18. 18. Sharding Components•  Shardso  Standaloneo  Replica Set•  Config Servers•  Mongos
  19. 19. Replica Set as a ShardAdd 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. 20. Selecting Shard Key•  Distribution of Data•  Hashed Shard Key•  Chunks and Balancing
  21. 21. Enable ShardingYou must enable sharding on each database separately> sh.enableSharding("mydatabase")And for each collection> sh.shardCollection( "mydatabase.mycol", { "userId" : 1 } )
  22. 22. ThanksIf you have any questions, please feel free to ask
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×