Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to MongoDB (from Austin Code Camp)

10,306 views

Published on

A presentation by Chris Edwards on MongoDB given at the Austin Code Camp 2010.

Published in: Technology
  • Dating direct: ♥♥♥ http://bit.ly/2F7hN3u ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ♥♥♥ http://bit.ly/2F7hN3u ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Introduction to MongoDB (from Austin Code Camp)

  1. 1. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0 Chris Edwards
  2. 2. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  3. 3. What is the No-SQL Movement? Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  4. 4. What is the No-SQL Movement? “Next Generation Databases mostly addressing some of the points: being non-relational, distributed, open-source and horizontal scalable. ... schema-free, easy replication support, simple API, eventually consistent ...” - nosql-database.org Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  5. 5. What is the No-SQL Movement? “Next Generation Databases mostly addressing some of the points: being non-relational, distributed, open-source and horizontal scalable. ... schema-free, easy replication support, simple API, eventually consistent ...” - nosql-database.org • Non-Relational • Horizontally Scalable • Distributed • Schema-Free • Open-Source • Replication Support Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  6. 6. What is the No-SQL Movement? • Not all systems have the same data needs. • Use the right tool for the right job. • Sql is not always the best option, nor is it the only one. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  7. 7. What is the No-SQL Movement? • Not all systems have the same data needs. • Use the right tool for the right job. • Sql is not always the best option, nor is it the only one. Not Only SQL Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  8. 8. What is the No-SQL Movement? • Not all systems have the same data needs. • Use the right tool for the right job. • Sql is not always the best option, nor is it the only one. Not Only SQL It’s not about flaming SQL. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  9. 9. What is the No-SQL Movement? • Not all systems have the same data needs. • Use the right tool for the right job. • Sql is not always the best option, nor is it the only one. Not Only SQL It’s not about flaming SQL. Its about opening our minds to new technologies. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  10. 10. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  11. 11. What is MongoDB? • Document-oriented database - Uses JSON (BSON actually) • Schema-free • Performance - Written in C++ - Full index support - No transactions (has atomic operations) “Mongo only pawn in game of life” - Memory-mapped files (delayed writes) • Scalability - Replication - Auto-Sharding • Commercially supported (10gen) - Lots of documentation Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  12. 12. Other Features of MongoDB • Document-based queries - Flexible document queries expressed in JSON/Javascript. • Map Reduce - Flexible aggregation and data processing. - Queries run in parallel on all shards. • GridFS - Store files of any size easily. • Geospatial Indexing - Find object based on location. (i.e. find closest n items to x) Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  13. 13. Other Features of MongoDB • Supported Platforms - OSX - Linux - Solaris - Windows - FreeBSD Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  14. 14. MongoDB Basic Components • The Database Server • The Interactive Shell • The Sharding Router Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  15. 15. MongoDB Basic Components • The Database Server • The Interactive Shell • The Sharding Router mongod.exe The database server Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  16. 16. MongoDB Basic Components • The Database Server • The Interactive Shell • The Sharding Router mongod.exe mongo.exe The database server The interactive shell Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  17. 17. MongoDB Basic Components • The Database Server • The Interactive Shell • The Sharding Router mongod.exe mongo.exe The database server The interactive shell mongos.exe The sharding router Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  18. 18. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  19. 19. Installing MongoDB 1. Download MongoDB. www.mongodb.com/ downloads 2. Extract it. 3. Create the data folder. usually /data/db -or- C: datadb 4. Run mongod.exe Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  20. 20. Installing MongoDB 1. Download MongoDB. www.mongodb.com/ downloads 2. Extract it. 3. Create the data folder. usually /data/db -or- C: datadb 4. Run mongod.exe That’s it! Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  21. 21. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  22. 22. Accessing MongoDB via the Shell • Inserting a document into a collection. • Querying a collection. • Modifying a document. • Deleting a document. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  23. 23. Accessing MongoDB via the Shell • Inserting a document into a collection. • Querying a collection. • Modifying a document. • Deleting a document. Lets do it! Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  24. 24. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  25. 25. Accessing MongoDB via C# • mongodb-csharp driver - Most mature driver for C#. - Look at basic functionality. - Then using LINQ. • NoRM driver - Using NoRM for strongly typed access. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  26. 26. Accessing MongoDB via C# • mongodb-csharp driver - Most mature driver for C#. - Look at basic functionality. - Then using LINQ. • NoRM driver - Using NoRM for strongly typed access. For more information and/or drivers for other languages, check out www.mongodb.org Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  27. 27. Accessing MongoDB via C# Demo of using the mongodb-csharp driver. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  28. 28. Accessing MongoDB via C# Demo of using the NoRM driver Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  29. 29. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  30. 30. Accessing MongoDB via REST • To enable basic REST interface, use --rest command line. - mongod.exe --rest • REST interface uses port +1000. - http://127.0.0.1:28017/database/collection/ - http://127.0.0.1:28017/database/collection/?filter&Field=Value • Full REST support is provided by the Sleepy.Mongoose lib. - http://github.com/kchodorow/sleepy.mongoose Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  31. 31. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  32. 32. MongoDB Replication • Master-Slave - Master - mongod.exe --master - Slave - mongod.exe --source <master url>:<master port> - Slave can use --slavedelay <delay in seconds> to have a rolling backup. • Replica Pairs (obsolete) • Replica Sets (to be released in 1.6) - Full Failover support - Supports more than 2 servers in a replica cluster - Data center and rack aware - Can have passive set members (slaves) that are never primary • Master-Master (limited) - Both masters are also configured as slaves - Safe for insert, delete by id, and any queries - Unsafe for concurrent updates of single object Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  33. 33. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  34. 34. MongoDB Auto-Sharding: Features • Based on a defined shard key. • Auto-balances as shard servers are added or removed. - Can go from single master to sharded system with zero downtime. • Failover handled through replica sets. (each shard replicated) • Map Reduce queries are run in parallel across shards. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  35. 35. MongoDB Auto-Sharding: Architecture • Shard Servers - Instance of mongod.exe --shardsvr - Optionally configured with a replication set for failover. • Config Servers - Instance of mongod.exe --configsvr - Usually a group of 3. System is up so long as 1 config server is running. • Shard Routers - Instance of mongos.exe --configdb <config server>:<config port> - Acts like mongod.exe to clients. - Can be on the same box as a shard server. - Can run on appserver to reduce traffic. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  36. 36. MongoDB Auto-Sharding: Architecture Sample Logical Architecture Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  37. 37. MongoDB Auto-Sharding: Architecture Sample Physical Architecture Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  38. 38. MongoDB Auto-Sharding: Configuration Startup Servers • Startup Shard Servers - mongod.exe --shardsvr • Startup Config Servers - mongod.exe --configsvr • Startup Shard Routers Configure --configdb <config server>:<config port> - mongos.exe Cluster • Add Shards to the Cluster - Execute the following command for each shard using either the driver or shell. - db.runcommand( { addshard : “<shard server>:<shard server port>” } ); • Enable Sharding on the Databases to Shard - db.runcommand( { enablesharding : “<dbname>” } ); Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  39. 39. MongoDB Session Roadmap • What is the NoSQL Movement? • What is MongoDB? • Installing • Using the Mongo Shell • Accessing MongoDB via C# - Basic Driver (mongodb-csharp driver) - Using Linq - Using NoRM for strong typing • Accessing MongoDB via REST • Replication • Sharding Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0
  40. 40. Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0 ?
  41. 41. About Me Chris Edwards Developer at BancVue Ltd Email: ChrisEdwards357@gmail.com Blog: http:// chrisedwards.dreamhosters.com Twitter: @cedwards Github: http://github.com/chrisedwards BancVue Web: www.bancvue.com Phone: 877.342.2557 We are hiring C# developers: Introduction to MongoDB A No-SQL Persistence Alternative A U S T I N - C O D E - C A M P - 2 0 1 0

×