cassandra 3.0中的cassandra cli“列表”

cassandra 3.0中的cassandra cli“列表”,cassandra,cassandra-cli,Cassandra,Cassandra Cli,我想在cassandra 3.0中查看rowkey及其存储的数据。我知道,贬值的cassandra cli有“list”命令。但是,在cassandra 3.0中,我找不到“list”命令的替代品。有人知道“list”的新cli命令吗?您可以按照@chris lohfink的建议使用sstabledump实用程序。如何使用它?创建键空间,其中的表填充一些数据: cqlsh> CREATE KEYSPACE IF NOT EXISTS minetest WITH REPLICATION =

我想在cassandra 3.0中查看rowkey及其存储的数据。我知道,贬值的cassandra cli有“list”命令。但是,在cassandra 3.0中,我找不到“list”命令的替代品。有人知道“list”的新cli命令吗?

您可以按照@chris lohfink的建议使用sstabledump实用程序。如何使用它?创建键空间,其中的表填充一些数据:

cqlsh> CREATE KEYSPACE IF NOT EXISTS minetest WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

cqlsh> CREATE TABLE object_coordinates (
   ... object_id int PRIMARY KEY,
   ... coordinate text
   ... );

cqlsh> use minetest;

cqlsh:minetest> insert into object_coordinates (object_id, coordinate) values (564682,'59.8505,34.0035');
cqlsh:minetest> insert into object_coordinates (object_id, coordinate) values (1235,'61.7814,40.3316');
cqlsh:minetest> select object_id, coordinate, writetime(coordinate) from object_coordinates;

 object_id | coordinate      | writetime(coordinate)
-----------+-----------------+-----------------------
      1235 | 61.7814,40.3316 |      1480436931275615
    564682 | 59.8505,34.0035 |      1480436927707627

(2 rows)
object_id是一个主分区键,坐标是集群键

刷新对磁盘的更改:

# nodetool flush
在磁盘上查找sstable并对其进行分析:

# cd /var/lib/cassandra/data/minetest/object_coordinates-e19d4c40b65011e68563f1a7ec2d3d77

# ls
backups  mc-1-big-CompressionInfo.db  mc-1-big-Data.db  mc-1-big-Digest.crc32  mc-1-big-Filter.db  mc-1-big-Index.db  mc-1-big-Statistics.db  mc-1-big-Summary.db  mc-1-big-TOC.txt

# sstabledump mc-1-big-Data.db
[
  {
    "partition" : {
      "key" : [ "1235" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 18,
        "liveness_info" : { "tstamp" : "2016-11-29T16:28:51.275615Z" },
        "cells" : [
          { "name" : "coordinate", "value" : "61.7814,40.3316" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "564682" ],
      "position" : 43
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 61,
        "liveness_info" : { "tstamp" : "2016-11-29T16:28:47.707627Z" },
        "cells" : [
          { "name" : "coordinate", "value" : "59.8505,34.0035" }
        ]
      }
    ]
  }
]
或使用-d标志:

输出显示1235和564682,并在这些分区中保存坐标

链接到文档


PS.sstabledump由ubuntu中的cassandra工具包提供。

cqlsh中的表中选择*。单元格不再像旧格式那样排列在磁盘上,因此CQL SELECT代表您的数据。但我想看看Cassandra是如何将这些数据存储在引擎盖下的。select*from表格不显示以下格式:RowKey:100。=>名称=,值=,时间戳=1387。。07. => 名称=tmp,值=51cc0000,时间戳=1387。。。。卡桑德拉是如何将我的select*from表格存储在引擎盖下的?在cassandra 3中,我不能再使用列表了。如果真的想深入了解它的存储方式,可以使用sstabledump实用程序-d选项进行更紧凑的阅读。如需更多交互功能,您可以使用中的cqlsh脱机功能
# sstabledump mc-1-big-Data.db -d
[1235]@0 Row[info=[ts=1480436931275615] ]:  | [coordinate=61.7814,40.3316 ts=1480436931275615]
[564682]@43 Row[info=[ts=1480436927707627] ]:  | [coordinate=59.8505,34.0035 ts=1480436927707627