Couchdb

426 views
376 views

Published on

Text: http://www.scribd.com/doc/83624536/Couch

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
426
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Couchdb

  1. 1. Привет!
  2. 2. NoSQL &CouchDB Епифанов Иван
  3. 3. SQL
  4. 4. SQL MySQLPostgreSQL Oracle MSSQL
  5. 5. NoSQL
  6. 6. Key-Value: Redis Membased TarantoolTokyo cabinet (DBM)
  7. 7. key -> ?????
  8. 8. session_id =>{ “serialized”:”data”}
  9. 9. GRAPH: Neo4j InfiniteGraph
  10. 10. Вася ID ID ID IDПетя ID ID Коля
  11. 11. Document-oriented: MongoDB CouchDB
  12. 12. { "_id": "5b8c0893e90316c578af172e073ed132", "type": "speech", "title": "Hello NoSQL", "author" "iSage", "text": "$this", "tags": [ "nosql", "mongo", "couch", "whisky", "boring" ], "listeners": [ { "name": "Dmitry", "position": "manager" }, { "name": "Sergey", "position": "team lead" }, ... ]}
  13. 13. MapReduce!
  14. 14. [ document, => map() document, => map() document, => map() document, => map()]
  15. 15. map = function(document) { for (tag in document.tags) { emit(tag, 1 ); }};
  16. 16. [ “tagname1”: 1, “tagname2”: 1, “tagname3”: 1, ... “tagnameN”: 1]
  17. 17. reduce = function( key , value ) { var total = 0; for (var i = 0;i < values.length;i++) { total += values[i]; } return total;};
  18. 18. [ “tagname1”: 56, “tagname2”: 42, “tagname3”: 13, ... “tagnameN”: 4]
  19. 19. 36 21 15 5 162 13 4 1 5 11
  20. 20. CouchDB
  21. 21. CouchDB C + Erlang
  22. 22. CouchDB C + Erlang ACID
  23. 23. CouchDB C + Erlang ACIDmaster-master
  24. 24. CouchDB C + Erlang ACIDmaster-master JSON
  25. 25. CouchDB C + Erlang ACIDmaster-master JSON HTTP
  26. 26. CouchDB C + Erlang ACIDmaster-master JSON HTTP RESTful
  27. 27. POST http://couchdb/database/{ “name”: “oh hai”, “text”: “well, hello there”}<= 5b8c0893e90316c578af172e073ed132
  28. 28. GEThttp://couchdb/database/5b8c0893e90316c578af172e073ed132<={ “_id”: “5b8c0893e90316c578af172e073ed132” “name”: “oh hai”, “text”: “well, hello there”}
  29. 29. PUThttp://couchdb/database/5b8c0893e90316c578af172e073ed132{ “name”: “oh hai”, “text”: “well, hello there!”}<= 5b8c0893e90316c578af172e073ed132
  30. 30. DELETEhttp://couchdb/database/5b8c0893e90316c578af172e073ed132<= 200 OK
  31. 31. { "_id": "_design/users", "language": "javascript", "views": { "by_mail": { "map": "function(doc) { if (doc.type==user) emit(doc.email,doc); }" }, "by_oauth2_id": { ... }, "by_oauth1_id": { ... } }}
  32. 32. + Прост+ Понятен+ JSON+ Гибкая авторизация+ ACID+ full master replication, sharding+ HTTP/Erlang Server+ cp -r /my/database/ ~/couch_backups/+ no structure – no versions!
  33. 33. + Прост+ Понятен+ JSON+ Гибкая авторизация+ ACID+ full master replication, sharding+ HTTP/Erlang Server+ cp -r /my/database/ ~/couch_backups/+ no structure – no versions!- медленнее mongo, redis, etc.- http = slow- MapReduce(MapReduce(MapReduce()))
  34. 34. BONUS
  35. 35. ??????

×