Slide 1

Slide 1 text

No-SQL & mongoDB @liushuaikobe

Slide 2

Slide 2 text

What’s No-SQL?

Slide 3

Slide 3 text

Strozzi NoSQL (1998) RDBMS operator-stream paradigm(PIPE) a set of shell routines that access normal files of the OS Carlo Strozzi

Slide 4

Slide 4 text

No-SQL == Not Have SQL

Slide 5

Slide 5 text

No-SQL == Not Have Structured Query Language SQL

Slide 6

Slide 6 text

…departs from the relational model altogether; it should therefore have been called more appropriately 'NoREL'.

Slide 7

Slide 7 text

A meetup@San Francisco ——"open source, distributed, non relational databases” Organized by Johan Oskarsson(Last.fm) Google's Bigtable & Amazon's Dynamo Eric Evans(then in RackSpace) reintroduced “No-SQL”

Slide 8

Slide 8 text

No-SQL == non-relational

Slide 9

Slide 9 text

Eric Evans My regret however isn't about what the name says, it's about what it doesn't.

Slide 10

Slide 10 text

no:sql(east) conference@ Atlanta

Slide 11

Slide 11 text

> select fun, profit > from real_world > where relational=false;

Slide 12

Slide 12 text

No-SQL == Not Only SQL

Slide 13

Slide 13 text

CAP Theorem (Eric Brewer) Consistency Partition Tolerance Availability

Slide 14

Slide 14 text

BASE neutral A C I D PH S B E A

Slide 15

Slide 15 text

asically vailable ventually Consistent oft-state S B E A

Slide 16

Slide 16 text

Why No-SQL? Traditional RDBMS —— CA Do We really need Transaction? Horizontal-Scale

Slide 17

Slide 17 text

List Of NoSQL DBs Wide Column Store Document Store Key Value / Tuple Store Graph Databases …

Slide 18

Slide 18 text

mongoDB

Slide 19

Slide 19 text

10gen established in 2007, @New York originally aimed to build a Paas architecture released MongoDB, maintaining it

Slide 20

Slide 20 text

MongoDB Inc. (2013.08) established in 2007, @New York originally aimed to build a Paas architecture released MongoDB, maintaining it

Slide 21

Slide 21 text

MongoDB document-oriented(BSON) Storage schema-free high-performance build for scale

Slide 22

Slide 22 text

Document

Slide 23

Slide 23 text

Data-Model Design References Embedded

Slide 24

Slide 24 text

Reference

Slide 25

Slide 25 text

Embedded

Slide 26

Slide 26 text

which way is better? No Define answer.

Slide 27

Slide 27 text

A Instance

Slide 28

Slide 28 text

{          "actor_attributes"  :  {                  "name"  :  "Dan  Tao",                  "company"  :  "Google",                  ...                  "email"  :  "[email protected]"          },          "repository"  :  {                  "fork"  :  false,                  "watchers"  :  0,                  "description"  :  "Oh,  nothing,  nothing",                  ...                  "id"  :  13155632,                  "name"  :  "breakneck"          },          "url"  :  "https://github.com/dtao/breakneck/compare/dccee09561...38984e5dce",          "created_at"  :  "2013-­‐09-­‐28T18:00:06-­‐07:00",          "actor"  :  "dtao",          "public"  :  true,          "type"  :  "PushEvent",          "payload"  :  {                  "shas"  :  [                            [                                  ...                          ]                  ],                  "head"  :  "38984e5dce1a21b778d4c26bde493270b4625662",                  "ref"  :  "refs/heads/master",                  "size"  :  1          }   }

Slide 29

Slide 29 text

RDBMS——ERD Actor Repo Event 1..n 1..1 1..n 1..1

Slide 30

Slide 30 text

While in mongo… {   "_id"  :  ObjectId("5287d3e947e36f2280584179")   "actor_attributes"  :  {                  "name"  :  "Dan  Tao",                  "company"  :  "Google",                  ...                  "email"  :  "[email protected]"          }   } {   "_id"  :  ObjectId("5287d3e947e36f22805844b3")   "actor_attributes"  :  {                  "name"  :  "Dan  Tao",                  "company"  :  "Google",                  ...                  "email"  :  "[email protected]"          }   } {   "_id"  :  ObjectId("5287d3e947e36f22805844c9")   "actor_attributes"  :  {                  "name"  :  "Dan  Tao",                  "company"  :  "Google",                  ...                  "email"  :  "[email protected]"          }   } Actor

Slide 31

Slide 31 text

{   "_id"  :  ObjectId("5287d41647e36f2280586033"),   “repository"  :  {                  "fork"  :  false,                              ...                    "name"  :  "breakneck"          },          "actor"  :  "Sam",          …          "payload"  :  {                  "shas"  :  [                            [                                  ...                          ]                  ],                  "ref"  :  "refs/heads/master",                  "size"  :  1          }   } Event {   "_id"  :  ObjectId("5287d41647e36f2280586035"),   “repository"  :  {                  "fork"  :  false,                              ...                    "name"  :  "breakneck"          },          "actor"  :  "Tom",          …          "payload"  :  {                  "shas"  :  [                            [                                  ...                          ]                  ],                  "ref"  :  "refs/heads/master",                  "size"  :  1          }   } {   "_id"  :  ObjectId("5287d41647e36f2280586537"),   “repository"  :  {                  "fork"  :  false,                              ...                    "name"  :  "breakneck"          },          "actor"  :  "Mike",          …          "payload"  :  {                  "shas"  :  [                            [                                  ...                          ]                  ],                  "ref"  :  "refs/heads/master",                  "size"  :  1          }   }

Slide 32

Slide 32 text

Summary No-SQL => No? No! Why No-SQL? CAP & BASE MongoDB (Inc.) Schema design

Slide 33

Slide 33 text

How to Choose? Depending on your needs…

Slide 34

Slide 34 text

Thanks @liushuaikobe

Slide 35

Slide 35 text

Q & A http:/ /www.girlsgonestrong.com/video-qa/