cassandra 數據模型簡介

1.Column  && Standard Column Family

RowKey: app1
=> (column=appName, value=app1, timestamp=1397200197351000)
=> (column=avgTime, value=8.0, timestamp=1397200197351001)
-------------------
RowKey: app-warning
=> (column=appName, value=app, timestamp=1397202476370000)
=> (column=level, value=warning, timestamp=1397202476371000)
=> (column=sum, value=5, timestamp=1397202476373000)
-------------------
RowKey: app2
=> (column=appName, value=app2, timestamp=1397200198380000)
=> (column=avgTime, value=9.0, timestamp=1397200198381000)
-------------------
RowKey: app-error
=> (column=appName, value=app, timestamp=1397202477375000)
=> (column=level, value=error, timestamp=1397202477376000)
=> (column=sum, value=5, timestamp=1397202477377000)
上面的就是一個Standard Column Family 


(column=appName, value=app, timestamp=1397202477375000)
這些就是Column 


可見:Standard Column Family 是由 Key 值 組合的一些Column 組成的



2. Super Column && Super Column Family

RowKey: 2012-10-1-10
=> (super_column=1,
     (column=appName, value=app2, timestamp=1393920048631000)
     (column=averResTime, value=2, timestamp=1393920048637000))
=> (super_column=2,
     (column=appName, value=app2, timestamp=1393921235195000)
     (column=averResTime, value=2, timestamp=1393921235201000))
-------------------
RowKey: 2013-10-28-14
=> (super_column=api.cf0.local,
     (column=appName, value=api.cf0.local, timestamp=1394432030019000)
     (column=averResTime, value=0.009666666666666665, timestamp=1394432030019001))
-------------------
RowKey: 2013-10-28-15
=> (super_column=announcemen.cf0.local,
     (column=appName, value=announcemen.cf0.local, timestamp=1394432030118000)
     (column=averResTime, value=0.007, timestamp=1394432030118001))
=> (super_column=announcement.cf0.local,
     (column=appName, value=announcement.cf0.local, timestamp=1394432030114000)
     (column=averResTime, value=0.0086, timestamp=1394432030114001))

這個就是一個Super Column Family 

加黑的就是一個簡單的Super Column


可見:一個Super Column Family 是 有一些RowKey 代表的 Column family 組成的 (自己總結,錯誤自負)


3 Keyspace 

一個keyspace 可以包含多個Column Family 


4 schema 數據庫中的概念  --查了下定義 

A schema is a collection of database objects (used by a user.).

schema objects are the logical structures that directly refer to the database’s data.

A user is a name defined in the database that can connect to and access objects.

schemas and users help database administrators manage database security.


應該是類似oracle ,這個還有待考證~



 

發佈了14 篇原創文章 · 獲贊 0 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章