exp*_*ter 6 storage cassandra cassandra-cli cassandra-2.0 cassandra-3.0
根据这个问题,Cassandra的存储格式在3.0中更新.
如果之前我可以使用cassandra-cli来查看SSTable是如何构建的,那就得到这样的结果:
[default@test] list phonelists;
-------------------
RowKey: scott
=> (column=, value=, timestamp=1374684062860000)
=> (column=phonenumbers:bill, value='555-7382', timestamp=1374684062860000)
=> (column=phonenumbers:jane, value='555-8743', timestamp=1374684062860000)
=> (column=phonenumbers:patricia, value='555-4326', timestamp=1374684062860000)
-------------------
RowKey: john
=> (column=, value=, timestamp=1374683971220000)
=> (column=phonenumbers:doug, value='555-1579', timestamp=1374683971220000)
=> (column=phonenumbers:patricia, value='555-4326', timestamp=137468397122
Run Code Online (Sandbox Code Playgroud)
在最新版本的Cassandra中,内部正式会是什么样子?你能提供一个例子吗?
我可以使用什么实用程序以上面列出的方式查看Cassandra中表的内部表示,但是使用新的SSTable格式?
我在互联网上找到的所有内容都是分区标题如何存储列名,行存储聚类值以及没有重复值.
我该怎么看?
And*_*ert 12
在3.0之前,sstable2json是一个有用的工具,用于了解SSTables中数据的组织方式.这个功能目前还没有出现在cassandra 3.0中,但最终会有另一种选择.在此之前,我和Chris Lohfink 为Cassandra 3.0 开发了sstable2json(sstable-tools)的替代品,您可以使用它来了解数据的组织方式.有一些关于在CASSANDRA-7464中将其带入cassandra的讨论.
Cassandra和Cassandra 3.0旧版本之间的存储格式之间的关键区别在于,SSTable以前是分区及其单元格的表示(由其聚类和列名称标识),而对于Cassandra 3.0,SSTable现在表示分区及其行.
您可以通过访问此博客文章更详细地了解这些更改,这些更改的主要开发人员可以很好地解释详细信息.
您将看到的最大好处是,在一般情况下,您的数据大小将缩小(在某些情况下会受到很大影响),因为CQL引入的大量开销已被某些关键增强功能所消除.
这是一个显示C*2和3之间差异的示例.
架构:
create keyspace demo with replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
use demo;
create table phonelists (user text, person text, phonenumbers text, primary key (user, person));
insert into phonelists (user, person, phonenumbers) values ('scott', 'bill', '555-7382');
insert into phonelists (user, person, phonenumbers) values ('scott', 'jane', '555-8743');
insert into phonelists (user, person, phonenumbers) values ('scott', 'patricia', '555-4326');
insert into phonelists (user, person, phonenumbers) values ('john', 'doug', '555-1579');
insert into phonelists (user, person, phonenumbers) values ('john', 'patricia', '555-4326');
Run Code Online (Sandbox Code Playgroud)
sstable2json C*2.2输出:
[
{"key": "scott",
"cells": [["bill:","",1451767903101827],
["bill:phonenumbers","555-7382",1451767903101827],
["jane:","",1451767911293116],
["jane:phonenumbers","555-8743",1451767911293116],
["patricia:","",1451767920541450],
["patricia:phonenumbers","555-4326",1451767920541450]]},
{"key": "john",
"cells": [["doug:","",1451767936220932],
["doug:phonenumbers","555-1579",1451767936220932],
["patricia:","",1451767945748889],
["patricia:phonenumbers","555-4326",1451767945748889]]}
]
Run Code Online (Sandbox Code Playgroud)
sstable-tools toJson C*3.0输出:
[
{
"partition" : {
"key" : [ "scott" ]
},
"rows" : [
{
"type" : "row",
"clustering" : [ "bill" ],
"liveness_info" : { "tstamp" : 1451768259775428 },
"cells" : [
{ "name" : "phonenumbers", "value" : "555-7382" }
]
},
{
"type" : "row",
"clustering" : [ "jane" ],
"liveness_info" : { "tstamp" : 1451768259793653 },
"cells" : [
{ "name" : "phonenumbers", "value" : "555-8743" }
]
},
{
"type" : "row",
"clustering" : [ "patricia" ],
"liveness_info" : { "tstamp" : 1451768259796202 },
"cells" : [
{ "name" : "phonenumbers", "value" : "555-4326" }
]
}
]
},
{
"partition" : {
"key" : [ "john" ]
},
"rows" : [
{
"type" : "row",
"clustering" : [ "doug" ],
"liveness_info" : { "tstamp" : 1451768259798802 },
"cells" : [
{ "name" : "phonenumbers", "value" : "555-1579" }
]
},
{
"type" : "row",
"clustering" : [ "patricia" ],
"liveness_info" : { "tstamp" : 1451768259908016 },
"cells" : [
{ "name" : "phonenumbers", "value" : "555-4326" }
]
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
虽然输出较大(这更多是工具的结果).您可以看到的主要区别是:
我应该注意,在这个特定的示例数据案例中,新存储引擎的好处并没有完全实现,因为只有一个非聚类列.
此处未显示许多其他改进(例如存储行级范围逻辑删除的功能).
归档时间: |
|
查看次数: |
2395 次 |
最近记录: |