静态列在Cassandra中是如何存储的?能否有人举例说明Cassandra中静态列的设计实现?
静态列在Cassandra中是如何存储的?能否有人举例说明Cassandra中静态列的设计实现?
为什么不看一下磁盘上具有静态列的表的结构,然后找出答案呢?
cqlsh:test> CREATE TABLE test (k int, v int, s int static, d int, PRIMARY KEY(k,v))
cqlsh:test> INSERT INTO test (k, v, s, d) VALUES ( 1, 1 ,20, 1 );
cqlsh:test> INSERT INTO test (k, v, s, d) VALUES ( 1, 3 ,21, 2 );
cqlsh:test> INSERT INTO test (k, v, s, d) VALUES ( 1, 2 ,21, 2 );
nodetool flush
来制作我们的sstables。在数据目录中创建的.db文件上运行sstable2json
。[
{"key": "1", <--- K=1 Partition
"cells": [[":s","21",1425050917842350], <---- Our Static Column
["1:","",1425050906896717], < --- C=1 row
["1:d","1",1425050906896717], < --- C=1, D=1 value
["2:","",1425050917842350], < --- C=2 row
["2:d","2",1425050917842350], < --- C=2, D=2 value
["3:","",1425050912874025], <--- C=3 Row
["3:d","2",1425050912874025]]} <--- C=3, D=2 Value
]