Cassandra 資料儲存結構

2021-10-06 11:22:38 字數 878 閱讀 8716

cassandra 的資料模型是基於列族(column family)的四維或五維模型。它借鑑了 amazon 的 dynamo 和 google』s bigtable 的資料結構和功能特點,採用 memtable 和 sstable 的方式進行儲存。在 cassandra 寫入資料之前,需要先記錄日誌 ( commitlog ),然後資料開始寫入到 column family 對應的 memtable 中,memtable 是一種按照 key 排序資料的記憶體結構,在滿足一定條件時,再把 memtable 的資料批量的重新整理到磁碟上,儲存為 sstable 。

圖 1. cassandra 的資料模型圖:

1. cluster: cassandra 的節點例項,它可以包含多個 keyspace

2. keyspace: 用於存放 columnfamily 的容器,相當於關聯式資料庫中的 schema 或 database

3. columnfamily: 用於存放 column 的容器,類似關聯式資料庫中的 table 的概念

4. supercolumn:它是乙個特列殊的 column, 它的 value 值可以包函多個 column5. columns:cassandra 的最基本單位。由 name , value , timestamp 組成

下面是關於資料模型例項分析 :

圖 2. 資料模型例項分析

Cassandra儲存機制

摘要 在2009年興起的nosql運動中,cassandra是其中重要的乙個分布式key value資料庫產品,由facebook在2008年開源,目前是apache的頂級專案。在2009年興起的nosql運動中,cassandra是其中重要的乙個分布式key value資料庫產品,由faceboo...

有關cassandra的儲存引擎

cassandra使用乙個類似於日誌結構的結合樹 log structured merge tree 的儲存結構,不像傳統關聯式資料庫那樣使用b tree。cassandra會避免在寫之前去讀。寫前讀 read before write 特別是在乙個大的分布式系統裡,會對讀效能產生影響,還會帶來其它...

MariaDB的Cassandra儲存引擎

mariadb已經宣布了cassandra儲存引擎的乙個預覽版本。該外掛程式允許mariadb通過標準sql語法使用cassandra集群。u0026 xd n mariadb並不是第一款為cassandra提供sql支援的產品。例如,simba提供了乙個cassandra odbc驅動,可用於大多...