Cassandra 模式

默北 KairosDBCassandra 模式已关闭评论10,697字数 916阅读3分3秒阅读模式

Cassandra 模式包含三个列族:

  • data_points   保存数据
  • row_key_index 查询中索引查找到的行
  • string_index 在系统中用于回答查询的标记和指标

 数据点列族(Data Points Column Family)

该行主要由3部分连接在一起组成:文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

  1. 指标名称(UTF-8)
  2. 行时间戳
  3. 数据存储类型
  4. 连接的标记字符串 (tag1=val1:tag2=val2...)

列名是32位的数据。第31位是无符号从该行键(以毫秒为单位)的时间偏移量。最后一位是用于识别存储的值的类型(long = 0x0, float = 0x1)。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

列变量值取决于值的类型。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

值类型 描述
long Only significate bytes are stored. If the value is 1-255 then only one byte is stored, etc.
float The value is stored as either 5 or 9 bytes. The first byte identifies the value as either float or double and the remaining bytes are the data.

行的长度被设定为正好3周数据或1814400000列。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

行键索引列族(Row Key Index Column Family)

当查询数据时,该行被主要使用到。该行键是指标的名称。列名是从data_points列族的行键。该列没有值。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

字符串索引列族(String Index Column Family)

在系统中通过索引来查找哪些指标名称,标记名称和标记值。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

模式如何使用的?

当查询特定指标时,行键索引是列的一个片段,返回包含数据的行。该行键根据是否指定了任何标记来过滤。多hector 获取调用,获取来自各行的数据。如果任何行有更多的数据,剩下的使用单独的更大的缓冲区取出。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

与OpenTSDB HBase比较

其一,我们不使用ID字符串。 字符串数据(指标名称和标签)被写入到行键和相应的索引。因为Cassandra 是宽行,较少的键写入数据库。使用ID节省的空间是微妙的而且不使用ID在访问集群时可以避免使用任何类型的锁。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

在OpenTSDB HBase下,默认的行大小是1小时。而Cassandra是3周。文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/ 文章源自运维生存时间-https://www.ttlsa.com/kairosdb/cassandra-schema/

weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
默北
  • 本文由 发表于 25/11/2014 01:00:41
  • 转载请务必保留本文链接:https://www.ttlsa.com/kairosdb/cassandra-schema/
  • cassandra
  • HBase
  • KairosDB
  • OpenTSDB 时间序列数据库