nosql sharing
TRANSCRIPT
Trend 1: 資料量的成長Twitter at 400M Tweets Per Day in Jun’ 12Facebook at 1B Users in Oct’ 12
1億用戶數 4.5年 (1665天 )
Trend 3: “ ”半結構化資料 分析的需求
• Semi-structured datao Data that does not reside in fixed fields but use tags
or other markers to capture elements of the data
• 例如 : Logs、 GPS 座標、 XML、 JSON、網頁內容 (HTTP Tagged text)
Case Study:復仇者聯盟
• 2012年上映,票房超過 10億美金• 針對觀眾對預告片的評價,分析了 11億條推特推文、 570萬篇部落格以及論壇貼文、 3 50萬條相關訊息,即時建議片商做出因應 對策
SQL的限制
• Table Lock (Transaction)
• Join, Join, Join (正規化 )
• Schema Change (資料型態 /長度 )
• Operational Maintenance( …備份 )
• Disaster Recovery(Cluster/Log shipping)
• Scaleout
SPRAIN
http://blogs.the451group.com/information_management/2012/11/02/updated-database-landscape-graphic/
• 不是 Relational Database• 沒有 Schema (Schema-free)
• 沒有 Join
• 沒有正規化
• 是另一種的資料儲存方式• 分散式架構• Open Source
• 最終一致性 Eventually Consistency
No SQL
CAP定律
• Consistency: 一致性所有節點在同一時間都具有相同的數據
• Availability: 可用性保證每個請求不管成功或者失敗都有響應
• Partition Tolerance: 分隔容忍 系統中任意訊息的失敗不會影響系統的繼續運作
理論上無法同時兼顧 CAP三種特性,NoSQL資料庫通常會選擇其中兩種特性來設計,通常是選擇 CP或 AP
http://blog.nahurst.com/visual-guide-to-nosql-systems
{ “_id” : 1001, “customer_id”: 98234}
{ “_id” : 1002, “customer_id”: 98311, “discount”: “Y” }
_id: 1001
_id: 1002
Key Value
Table: Customer
{ “_id” : 1001, “customer_id”: 7231, “line_items” : [ {“product_id”: 4555, “quantity”: 8}, {“product_id”: 7655, “quantity”: 4}, {“product_id”: 8755, “quantity”: 3}] }
{ “_id” : 1002, “customer_id”: 98311, “line_items” : [ {“product_id”: 4555, “quantity”: 3}, {“product_id”: 2155, “quantity”: 4}], “discount”: “Y” }
Key Document
_id: 1001
_id: 1002
Table: Customer
Graph
Connie Ma
Max Cheng
Mahendra Negi
Eva Chen
Report To
Report To
IS
Function
Function
Jo Ma
Claudia Wu
Terry Huang
Alex Kuo
Report To
Report ToReport To
Report To
Report To
HR
參考資料
• Martin Fowler: NoSQL Distilled to an Hour http://vimeo.com/66052102
• http://nosql.org.tw/
• http://blog.nosqlfan.com/
• http://www.csdn.net/article/tag/nosql
MongoDB
• JSON like document store (BSON)
• Embeded, Referenced
• Sharding:將數據水平切分到不同物理節點• Replica Set:數據同步• Mongo Query Language
• HTTP / REST API
• GridFS:文件存儲 API
• MapReduce:可以進行複雜的統計和並行計算