2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)

2,000 views

Published on

Folienset von meinem eintägigen Workshop bei der DNUG Braunschweig.

Blogeintrag: http://blog.johanneshoppe.de/2012/08/nosql-bootcamp-fazit/

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

  • Be the first to like this

No Downloads
Views
Total views
2,000
On SlideShare
0
From Embeds
0
Number of Embeds
1,137
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2012-08-29 - NoSQL Bootcamp (Redis, RavenDB & MongoDB für .NET Entwickler)

  1. 1. {NoSQL-BootcamP}
  2. 2. {Intro}case file 001
  3. 3. Daten 2002 2004 2006 2008 2010 2012
  4. 4. Scale-up
  5. 5. Scale-out
  6. 6. Schemafrei
  7. 7. Anforderungenan ein verteiltes System Consistency Konsistenz Partition Availability Tolerance Verfügbarkeit Ausfalltoleranz
  8. 8. ››
  9. 9. ›››
  10. 10. ›››
  11. 11. ››
  12. 12. “Drum prüfe,wer sich ewig bindet.”Friedrich Schiller
  13. 13. › › ›››
  14. 14. {Redis}case file 002
  15. 15. › SET note1:title "Mittag"› SET note1:message "nicht vergessen"› KEYS note1:*› GET note1:title› DEL note1:title note1:message
  16. 16. http://bit.ly/ISv9f6
  17. 17. {RavenDB}case file 003
  18. 18. › › ››
  19. 19. ›› ››
  20. 20. › ›› › ›
  21. 21. › ›››
  22. 22. › › ›
  23. 23. › › › ›
  24. 24. › › ››
  25. 25. ››
  26. 26. ›››
  27. 27. “While being RESTful is a goal of theHTTP API, it is secondary to the goal ofexposing easy to use and powerfulfunctionality”Ayende Rahien on the HTTP API - http://ravendb.net/documentation/docs-http-api-restful
  28. 28. › › ›C:>curl -X GET http://localhost:8080/docs/Categories/1 -iHTTP/1.1 200 OKContent-Type: application/json; charset=utf-8ETag: 00000000-0000-0200-0000-000000000004{ "Name" : "Normal Importance", "Color" : "green"}
  29. 29. Classic Linq Style Lucene Stylevar notes = session var notes = session.Advanced.Query<Note>() .LuceneQuery<Note>().Where(n => n.Category == “Important") .Where(“Category:Important").ToArray(); .ToArray();
  30. 30. {MongoDB}case file 004
  31. 31. CODASYL model SQL Agile becoming more Google MongoDB initial published invented popular BigTable releaseIBM’s Oracle Brewer’s Amazon IMS INGRES founded CAP born Dynamo1966 1969 1970 1973 1974 1977 1985 1990’s 2000 2004 2007 2008 2009 10gen NoSQL Codd publishes Term “object-oriented founded Movement relational model paper database” appears in 1970 Apache Cassandra initial release
  32. 32. ›››
  33. 33. –› use WebNote› db.Notes.save( { Title: Mittag, Message: nicht vergessen‘ } );› db.Notes.save
  34. 34. –for(i=0; i<1000; i++) { [quiz, essay, exam].forEach(function(name) { var score = Math.floor(Math.random() * 50) + 50; db.scores.save({student: i, name: name, score: score}); }); } db.scores.count();
  35. 35. –› db.Notes.find();› db.Notes.find({ Title: /Test/i });› db.Notes.find( { "Categories.Color": "red"}).limit(1);
  36. 36. –› db.Notes.update({Title: Test}, {$set: {Categories: []}});› db.Notes.update({Title: Test}, {$push: { Categories: {Color: Red} } });
  37. 37. –› db.dropDatabase();› db.Notes.drop();› db.Notes.remove();
  38. 38. ››
  39. 39. {PAUSE!}
  40. 40. Hands ONcase file 005
  41. 41. ››››››
  42. 42. › use digg› db.stories.findOne();
  43. 43. › use digg;› db.people.update({name: Smith}, {$set: {interests: []}});› db.people.update({name: Smith}, {$push: {interests: [chess]}});
  44. 44. map = function() { emit(this.user.name, {diggs: this.diggs, posts: 0});}
  45. 45. reduce = function(key, values) { var diggs = 0; var posts = 0; values.forEach(function(doc) { diggs += doc.diggs; posts += 1; }); return {diggs: diggs, posts: posts};}
  46. 46. db.stories.mapReduce(map, reduce, {out: digg_users});db.digg_users.find();
  47. 47. SIR,Yes,Sir!
  48. 48. Design Schemacase file 006
  49. 49. http://bsonspec.org
  50. 50.
  51. 51. NULL NULLNULL NULLNULL
  52. 52. > db.shapes.find()› { _id: "1", type: "c", area: 3.14, radius: 1}› { _id: "2", type: "s", area: 4, length: 2}› { _id: "3", type: "r", area: 10, length: 5, width: 2}// Shapes mit radius > 0 finden> db.shapes.find( { radius: { $gt: 0 } } )
  53. 53. blogs: { author : “Johannes", date : ISODate("2011-09-18T09:56:06.298Z"), comments : [ { author : “Klaus", date : ISODate("2011-09-19T09:56:06.298Z"), text : “toller Artikel" } ]}
  54. 54. blogs: { _id: 1000, author: “Johannes", date: ISODate("2011-09-18"), comments: [ {comment : 1)} ]}comments : { _id : 1, blog: 1000, author : “Klaus", date : ISODate("2011-09-19")}> blog = db.blogs.find({ text: "Destination Moon" });> db.comments.find( { blog: blog._id } );
  55. 55. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }
  56. 56. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Jede Kategorie verlinkt die IDs der Produktecategories: { _id: 20, name: "adventure", product_ids: [ 10, 11, 12 ] }categories: { _id: 21, name: "movie", product_ids: [ 10 ] }
  57. 57. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Jede Kategorie verlinkt die IDs der Produktecategories: { _id: 20, name: "adventure", product_ids: [ 10, 11, 12 ] }categories: { _id: 21, name: "movie", product_ids: [ 10 ] }// Alle Kategorien für ein Produkt> db.categories.find( { product_ids: 10 } )
  58. 58. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Kategorien beinhalten keine Assoziationencategories: { _id: 20, name: "adventure"}
  59. 59. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Kategorien beinhalten keine Assoziationencategories: { _id: 20, name: "adventure"}// Alle Produkte für eine Kategorie> db.products.find( { category_ids: 20 } )
  60. 60. // Jedes Produkt verlinkt die IDs der Kategorienproducts: { _id: 10, name: "Destination Moon", category_ids: [ 20, 30 ] }// Kategorien beinhalten keine Assoziationencategories: { _id: 20, name: "adventure"}// Alle Produkte für eine Kategorie> db.products.find( { category_ids: 20 } )// Alle Kategorien für ein Produkt product> product = db.products.find( { _id: some_id } )> db.categories.find({_id: {$in : product.category_ids}})
  61. 61. VielenDank!

×