SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
NOSQL?
MONGO, COUCH & CO.
    Michael Whittaker
   Webmontag Paderborn
      8. April 2013
ERFAHRUNGEN
NOSQL
NO SQL?
NOT ONLY SQL
WHY NOT ONLY SQL?
„BigData“?
Millionen                (PetaBytes)
 User?                    unstrukturiert




             CODD 1970

Realtime                 Commodity
Analytics?               Hardware?
Atomic            Consistent


           ACID
Isolated           Durable
Basic
                            Soft-State
Availability

               BASE
                Eventual
               Consistent
DB-TYPEN



Relationen / SQL    Graphen


   BigTable /      Dokumente /
 Spaltenbasiert      Objekte
SQL / RELATIONALES SCHEMA


Mitglieder




                                                 }
 ID          Name                Mail

  1   Max Mustermann      max@mustermann.de
                                                 Relation/
  2   Sandra Musterfrau   sandra@musterfrau.de    Tabelle
  3     Peter Müller        peter@mueller.de
SQL / RELATIONALES SCHEMA

                       Max ist mit
                    Sandra und Peter
                      befreundet
 Freundschaften
    Mitglied1_ID   Mitglied2_ID
    Max‘ ID 1            2    Sandra

     Max    1            3     Peter
OBJEKTGRAPH
max@...
                                                          peter@...

            Mitglied
                                  Freund
                                               Mitglied
    Max
                       Freund

                                                              Peter


                       Mitglied

          sandra@...                  Sandra
IST DAS NICHT...
IST DAS NICHT...
FAST EIN ER-DIAGRAMM?
                  kann das
            so nicht direkt in die
                     DB?
GRAPHDATENBANKEN
      NEO4J
DOKUMENTENORIENTIERTE
    DATENBANKEN
{name: „Mongo“, type: „DB“}
BSON-DOKUMENTE
           IN COLLECTIONS


    {
      "_id": {
          "$oid": "5056259d…000012",
      },
      "email": "max@mustermann.de",
      "name": "Max Mustermann"
    }
BSON-DOKUMENTE
           IN COLLECTIONS

    {
      "_id": {
          "$oid": "5056259d…000011",
      },
      "email": "max@mustermann.de",
      "name": "Max Mustermann",
      "friend_ids": ["5056259d…000012", "5056259d…000013"]
    }



                 Referenz auf IDs
BSON-DOKUMENTE
            IN COLLECTIONS

    {
      "_id": {
          "$oid": "5056259d…000011",
      },
      "email": "max@mustermann.de",
      "name": "Max Mustermann",
      "friend_ids": ["5056259d…000012", "5056259d…000013"],
      "addresses": [{
          "street": "Warburger Str. 100",
          "coords": [12.34, 23.45]
          }, …
      ]
    }
MONGODB QUERY


{
  > db.members.find( { "name": "Max Mustermann" } )

  > db.members.find( { "name": /max.*/i } )

  > db.members.find( { "friend_ids ": { $size: 0 } } )

  > db.members.find( { "friend_ids ": { $elemMatch: "50…11" } } )
ZUGRIFF



MongoDB-Server

Treiber

CREATE TABLE …
MONGOS STÄRKEN


Geschwindigkeit

JSON-Im/-Export / Hot Backups

Queries und Indizes (Geospatial, verschachtelt, ...)

Konsistenz
MONGODB USERS
JSON DOKUMENTE IN
              COUCHDB
    {
      "_id": "member_5056259d…000011",
      "type": "member",
      "email": "max@mustermann.de",
      "name": "Max Mustermann",
      "friend_ids": ["member_505…012", "member_505…013"],
      "addresses": [{
          "street": "Warburger Str. 100",
          "coords": [12.34, 23.45]
          }, …
      ]
    }


               http://localhost:5984/test/member_5056259d…000011
COUCHDB VIEWS
               (JS MAPREDUCE)


{
  function(doc) {
    if (doc.type === "member" && doc.name.test(/max.*/i)){
      emit(doc.name, doc)
    }
  }
COUCHDB VIEWS


{
  function(doc) {
    if (doc.type === "member" &&
        doc.addresses &&
        doc.addresses.length > 0){
      emit(doc.name, doc.addresses[0][street])
    }
  }




         http://localhost:5984/test/_design/names_with_street?key=Max+Mustermann
ZUGRIFF



CouchDB-Server

HTTP / Treiber (Wrapper)

Views definieren
COUCHDBS STÄRKEN


Built for the Web – HTTP/JSON

  CouchApp

Versionierung

Views / Indizes / MapReduce

High Availability
COUCHDB USERS
KEY-VALUE STORES
KEY-VALUE STORES

SPEICHERN WERTE MIT EINEM
       SCHLÜSSEL AB
memcached
MEMCACHED


  speichert beliebige Zeichenketten im RAM ab

  weitverbreitet, „memcache-Protokoll“ (Telnet)

  oft für Distributed Caching genutzt

{
  > set max_mustermann.street "Warburger Strasse 100"

  > get max_mustermann.street
REDIS

    speichert Zeichenketten, Zahlen, Arrays und Mengen
    im RAM* ab

    „Datenstruktur-Server“

    rasend schnell

    Replikation / Failover

{
    > set max_mustermann.profile_views 1
    > incr max_mustermann.profile_views    # => 2
blog.nahurst.com/visual-guide-to-nosql-systems
LINKS

Neo4J: neo4j.org
MongoDB: mongodb.org (try.mongodb.org)
CouchDB: couchdb.apache.org (couchapp.org)
Couchbase: couchbase.com
Memcached: memcached.org
Redis: redis.io
Cassandra: cassandra.apache.org
Riak: basho.com/riak/
GemStone/S: gemstone.com/products/gemstone
Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase vs Couchbase vs
Neo4j vs Hypertable vs ElasticSearch vs Accumulo vs VoltDB vs Scalaris comparison:
kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
DAS WAR‘S :-)


MichaelWhi online:

post@michael-whittaker.de

michael-whittaker.de

twitter.com/MichaelWhi

github.com/MichaelWhi
                            Folien von heute

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

NoSQL - Mongo, Couch und Co

  • 1. NOSQL? MONGO, COUCH & CO. Michael Whittaker Webmontag Paderborn 8. April 2013
  • 7. „BigData“? Millionen (PetaBytes) User? unstrukturiert CODD 1970 Realtime Commodity Analytics? Hardware?
  • 8. Atomic Consistent ACID Isolated Durable
  • 9. Basic Soft-State Availability BASE Eventual Consistent
  • 10. DB-TYPEN Relationen / SQL Graphen BigTable / Dokumente / Spaltenbasiert Objekte
  • 11. SQL / RELATIONALES SCHEMA Mitglieder } ID Name Mail 1 Max Mustermann max@mustermann.de Relation/ 2 Sandra Musterfrau sandra@musterfrau.de Tabelle 3 Peter Müller peter@mueller.de
  • 12. SQL / RELATIONALES SCHEMA Max ist mit Sandra und Peter befreundet Freundschaften Mitglied1_ID Mitglied2_ID Max‘ ID 1 2 Sandra Max 1 3 Peter
  • 13. OBJEKTGRAPH max@... peter@... Mitglied Freund Mitglied Max Freund Peter Mitglied sandra@... Sandra
  • 15. IST DAS NICHT... FAST EIN ER-DIAGRAMM? kann das so nicht direkt in die DB?
  • 17.
  • 18. DOKUMENTENORIENTIERTE DATENBANKEN
  • 20. BSON-DOKUMENTE IN COLLECTIONS {     "_id": {         "$oid": "5056259d…000012",     },     "email": "max@mustermann.de",     "name": "Max Mustermann" }
  • 21. BSON-DOKUMENTE IN COLLECTIONS {     "_id": {         "$oid": "5056259d…000011",     },     "email": "max@mustermann.de",     "name": "Max Mustermann", "friend_ids": ["5056259d…000012", "5056259d…000013"] } Referenz auf IDs
  • 22. BSON-DOKUMENTE IN COLLECTIONS {     "_id": {         "$oid": "5056259d…000011",     },     "email": "max@mustermann.de",     "name": "Max Mustermann", "friend_ids": ["5056259d…000012", "5056259d…000013"], "addresses": [{         "street": "Warburger Str. 100", "coords": [12.34, 23.45] }, … ] }
  • 23. MONGODB QUERY {   > db.members.find( { "name": "Max Mustermann" } )   > db.members.find( { "name": /max.*/i } )   > db.members.find( { "friend_ids ": { $size: 0 } } )   > db.members.find( { "friend_ids ": { $elemMatch: "50…11" } } )
  • 25. MONGOS STÄRKEN Geschwindigkeit JSON-Im/-Export / Hot Backups Queries und Indizes (Geospatial, verschachtelt, ...) Konsistenz
  • 27.
  • 28. JSON DOKUMENTE IN COUCHDB {     "_id": "member_5056259d…000011",     "type": "member",     "email": "max@mustermann.de",     "name": "Max Mustermann", "friend_ids": ["member_505…012", "member_505…013"], "addresses": [{         "street": "Warburger Str. 100", "coords": [12.34, 23.45] }, … ] } http://localhost:5984/test/member_5056259d…000011
  • 29. COUCHDB VIEWS (JS MAPREDUCE) {   function(doc) { if (doc.type === "member" && doc.name.test(/max.*/i)){ emit(doc.name, doc) } }
  • 30. COUCHDB VIEWS {   function(doc) { if (doc.type === "member" && doc.addresses && doc.addresses.length > 0){ emit(doc.name, doc.addresses[0][street]) } } http://localhost:5984/test/_design/names_with_street?key=Max+Mustermann
  • 31. ZUGRIFF CouchDB-Server HTTP / Treiber (Wrapper) Views definieren
  • 32. COUCHDBS STÄRKEN Built for the Web – HTTP/JSON CouchApp Versionierung Views / Indizes / MapReduce High Availability
  • 35. KEY-VALUE STORES SPEICHERN WERTE MIT EINEM SCHLÜSSEL AB
  • 37. MEMCACHED speichert beliebige Zeichenketten im RAM ab weitverbreitet, „memcache-Protokoll“ (Telnet) oft für Distributed Caching genutzt {   > set max_mustermann.street "Warburger Strasse 100" > get max_mustermann.street
  • 38.
  • 39. REDIS speichert Zeichenketten, Zahlen, Arrays und Mengen im RAM* ab „Datenstruktur-Server“ rasend schnell Replikation / Failover { > set max_mustermann.profile_views 1 > incr max_mustermann.profile_views # => 2
  • 41. LINKS Neo4J: neo4j.org MongoDB: mongodb.org (try.mongodb.org) CouchDB: couchdb.apache.org (couchapp.org) Couchbase: couchbase.com Memcached: memcached.org Redis: redis.io Cassandra: cassandra.apache.org Riak: basho.com/riak/ GemStone/S: gemstone.com/products/gemstone Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase vs Couchbase vs Neo4j vs Hypertable vs ElasticSearch vs Accumulo vs VoltDB vs Scalaris comparison: kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
  • 42. DAS WAR‘S :-) MichaelWhi online: post@michael-whittaker.de michael-whittaker.de twitter.com/MichaelWhi github.com/MichaelWhi Folien von heute