sstabledump

Dumps contents of given SSTable to standard output in JSON format.

Dumps contents of given SSTable to standard output in JSON format.

The default location of this SSTable tool depends on the type of installation:
  • Package installations: /usr/bin/
  • Tarball installations: installation_location/resources/cassandra/tools/bin

Synopsis

sstabledump
[-d] [-e] [-k partition_key]
[-l] [-t] [-x partition_key]
sstable_filepath
Table 1. Legend
Syntax conventions Description
UPPERCASE Literal keyword.
Lowercase Not literal.
Italics Variable value. Replace with a valid option or user-defined value.
[ ] Optional. Square brackets ( [ ] ) surround optional command arguments. Do not type the square brackets.
( ) Group. Parentheses ( ( ) ) identify a group to choose from. Do not type the parentheses.
| Or. A vertical bar ( | ) separates alternative elements. Type any one of the elements. Do not type the vertical bar.
... Repeatable. An ellipsis ( ... ) indicates that you can repeat the syntax element as often as required.
'Literal string' Single quotation ( ' ) marks must surround literal strings in CQL statements. Use single quotation marks to preserve upper case.
{ key:value } Map collection. Braces ( { } ) enclose map collections or key value pairs. A colon separates the key and the value.
<datatype1,datatype2> Set, list, map, or tuple. Angle brackets ( < > ) enclose data types in a set, list, map, or tuple. Separate the data types with a comma.
cql_statement; End CQL statement. A semicolon ( ; ) terminates all CQL statements.
[ -- ] Separate the command line options from the command arguments with two hyphens ( -- ). This syntax is useful when arguments might be mistaken for command line options.
' <schema> ... </schema> ' Search CQL only: Single quotation marks ( ' ) surround an entire XML schema declaration.
@xml_entity='xml_entity_type' Search CQL only: Identify the entity and literal value to overwrite the XML element in the schema and solrconfig files.

Definition

The short form and long form parameters are comma-separated.

Command arguments

-d
Display a CQL row per line.
-e
Display a list of partition keys.
-k, --key partition_key
Partition key to include.
-l
Output JSON lines, by partition.
-t
Print raw timestamps instead of ISO 8601 date strings.
-x, --exclude-key partition_key
Partition key to exclude. Ignored if -y option is given.

Examples

Dump contents of SSTable

sstabledump /var/lib/cassandra/data/cycling/birthday_list-f4f24621ce3f11e89d32bdcab3a99c6f/aa-1-bti-Statistics.db
[
  {
    "partition" : {
      "key" : [ "Claudio HEINEN" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 90,
        "liveness_info" : { "tstamp" : "2018-10-12T16:58:00.368228Z" },
        "cells" : [
          { "name" : "blist_", "deletion_info" : { "marked_deleted" : "2018-10-12T16:58:00.368227Z", "local_delete_time" : "2018-10-12T16:58:00Z" } },
          { "name" : "blist_", "path" : [ "bday" ], "value" : "27/07/1992" },
          { "name" : "blist_", "path" : [ "blist_age" ], "value" : "23" },
          { "name" : "blist_", "path" : [ "blist_nation" ], "value" : "GERMANY" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "Claudio VANDELLI" ],
      "position" : 91
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 179,
        "liveness_info" : { "tstamp" : "2018-10-12T16:58:00.354443Z" },
        "cells" : [
        { "name" : "blist_", "deletion_info" : { "marked_deleted" : "2018-10-12T16:58:00.354442Z", "local_delete_time" : "2018-10-12T16:58:00Z" } },
        { "name" : "blist_", "path" : [ "bday" ], "value" : "27/07/1961" },
        { "name" : "blist_", "path" : [ "blist_age" ], "value" : "54" },
        { "name" : "blist_", "path" : [ "blist_nation" ], "value" : "ITALY" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "Luc HAGENAARS" ],
      "position" : 180
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 275,
        "liveness_info" : { "tstamp" : "2018-10-12T16:58:00.374846Z" },
        "cells" : [
          { "name" : "blist_", "deletion_info" : { "marked_deleted" : "2018-10-12T16:58:00.374845Z", "local_delete_time" : "2018-10-12T16:58:00Z" } },
          { "name" : "blist_", "path" : [ "bday" ], "value" : "27/07/1987" },
          { "name" : "blist_", "path" : [ "blist_age" ], "value" : "28" },
          { "name" : "blist_", "path" : [ "blist_nation" ], "value" : "NETHERLANDS" }
        ]
      }
    ]
  }
]
      

Show a row per line in standard output of the cycling.birthday_list table

sstabledump /var/lib/cassandra/data/cycling/birthday_list-e439b9222bc511e8891b23da85222d3d/aa-2-bti-Data.db -d
[Claudio HEINEN]@0 Row[info=[ts=1521498957445075] ]:  | , [blist[age]=23 ts=1521498957445075], [blist[bday]=27/07/1992 ts=1521498957445075], [blist[nation]=GERMANY ts=1521498957445075]
[Claudio VANDELLI]@76 Row[info=[ts=1521498957437559] ]:  | , [blist[age]=54 ts=1521498957437559], [blist[bday]=27/07/1961 ts=1521498957437559], [blist[nation]=ITALY ts=1521498957437559]
[Luc HAGENAARS]@152 Row[info=[ts=1521498957448698] ]:  | , [blist[age]=28 ts=1521498957448698], [blist[bday]=27/07/1987 ts=1521498957448698], [blist[nation]=NETHERLANDS ts=1521498957448698]
[Toine POELS]@232 Row[info=[ts=1521498957451068] ]:  | , [blist[age]=52 ts=1521498957451068], [blist[bday]=27/07/1963 ts=1521498957451068], [blist[nation]=NETHERLANDS ts=1521498957451068]
[Allan DAVIS]@310 Row[info=[ts=1521498957430478] ]:  | , [blist[age]=35 ts=1521498957430478], [blist[bday]=27/07/1980 ts=1521498957430478], [blist[nation]=AUSTRALIA ts=1521498957430478]
[Laurence BOURQUE]@384 Row[info=[ts=1521498957441360] ]:  | , [blist[age]=23 ts=1521498957441360], [blist[bday]=27/07/1992 ts=1521498957441360], [blist[nation]=CANADA ts=1521498957441360]

Display a list of partition keys from the cycling.birthday_list table

sstabledump /var/lib/cassandra/data/cycling/birthday_list-e439b9222bc511e8891b23da85222d3d/aa-2-bti-Data.db -e
[ [ "Claudio HEINEN" ], [ "Claudio VANDELLI" ], [ "Luc HAGENAARS" ], [ "Toine POELS" ], [ "Allan DAVIS" ], [ "Laurence BOURQUE" ] ]

Display all rows in the partition

sstabledump /var/lib/cassandra/data/cycling/birthday_list-e439b9222bc511e8891b23da85222d3d/aa-2-bti-Data.db -k "Claudio HEINEN"
[
  {
    "partition" : {
      "key" : [ "Claudio HEINEN" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 75,
        "liveness_info" : { "tstamp" : "2018-03-19T22:35:57.445075Z" },
        "cells" : [
          { "name" : "blist", "path" : [ "age" ], "value" : "23" },
          { "name" : "blist", "path" : [ "bday" ], "value" : "27/07/1992" },
          { "name" : "blist", "path" : [ "nation" ], "value" : "GERMANY" }
        ]
      }
    ]
  }
]

Display all rows except those in the specified partition

sstabledump /var/lib/cassandra/data/cycling/birthday_list-e439b9222bc511e8891b23da85222d3d/aa-2-bti-Data.db -x "Claudio HEINEN"
[
  {
    "partition" : {
      "key" : [ "Claudio VANDELLI" ],
      "position" : 0
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 151,
        "liveness_info" : { "tstamp" : "2018-03-19T22:35:57.437559Z" },
        "cells" : [
          { "name" : "blist", "path" : [ "age" ], "value" : "54" },
          { "name" : "blist", "path" : [ "bday" ], "value" : "27/07/1961" },
          { "name" : "blist", "path" : [ "nation" ], "value" : "ITALY" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "Luc HAGENAARS" ],
      "position" : 152
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 231,
        "liveness_info" : { "tstamp" : "2018-03-19T22:35:57.448698Z" },
        "cells" : [
          { "name" : "blist", "path" : [ "age" ], "value" : "28" },
          { "name" : "blist", "path" : [ "bday" ], "value" : "27/07/1987" },
          { "name" : "blist", "path" : [ "nation" ], "value" : "NETHERLANDS" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "Toine POELS" ],
      "position" : 232
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 309,
        "liveness_info" : { "tstamp" : "2018-03-19T22:35:57.451068Z" },
        "cells" : [
          { "name" : "blist", "path" : [ "age" ], "value" : "52" },
          { "name" : "blist", "path" : [ "bday" ], "value" : "27/07/1963" },
          { "name" : "blist", "path" : [ "nation" ], "value" : "NETHERLANDS" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "Allan DAVIS" ],
      "position" : 310
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 383,
        "liveness_info" : { "tstamp" : "2018-03-19T22:35:57.430478Z" },
        "cells" : [
          { "name" : "blist", "path" : [ "age" ], "value" : "35" },
          { "name" : "blist", "path" : [ "bday" ], "value" : "27/07/1980" },
          { "name" : "blist", "path" : [ "nation" ], "value" : "AUSTRALIA" }
        ]
      }
    ]
  },
  {
    "partition" : {
      "key" : [ "Laurence BOURQUE" ],
      "position" : 384
    },
    "rows" : [
      {
        "type" : "row",
        "position" : 460,
        "liveness_info" : { "tstamp" : "2018-03-19T22:35:57.441360Z" },
        "cells" : [
          { "name" : "blist", "path" : [ "age" ], "value" : "23" },
          { "name" : "blist", "path" : [ "bday" ], "value" : "27/07/1992" },
          { "name" : "blist", "path" : [ "nation" ], "value" : "CANADA" }
        ]
      }
    ]
  }
]

Display each row in its own JSON map

sstabledump /var/lib/cassandra/data/cycling/birthday_list-e439b9222bc511e8891b23da85222d3d/aa-2-bti-Data.db -l
{"partition":{"key":["Claudio HEINEN"],"position":0},"rows":[{"type":"row","position":75,"liveness_info":{"tstamp":"2018-03-19T22:35:57.445075Z"},"cells":[{"name":"blist","path":["age"],"value":"23"},{"name":"blist","path":["bday"],"value":"27/07/1992"},{"name":"blist","path":["nation"],"value":"GERMANY"}]}]}
{"partition":{"key":["Claudio VANDELLI"],"position":76},"rows":[{"type":"row","position":151,"liveness_info":{"tstamp":"2018-03-19T22:35:57.437559Z"},"cells":[{"name":"blist","path":["age"],"value":"54"},{"name":"blist","path":["bday"],"value":"27/07/1961"},{"name":"blist","path":["nation"],"value":"ITALY"}]}]}
{"partition":{"key":["Luc HAGENAARS"],"position":152},"rows":[{"type":"row","position":231,"liveness_info":{"tstamp":"2018-03-19T22:35:57.448698Z"},"cells":[{"name":"blist","path":["age"],"value":"28"},{"name":"blist","path":["bday"],"value":"27/07/1987"},{"name":"blist","path":["nation"],"value":"NETHERLANDS"}]}]}
{"partition":{"key":["Toine POELS"],"position":232},"rows":[{"type":"row","position":309,"liveness_info":{"tstamp":"2018-03-19T22:35:57.451068Z"},"cells":[{"name":"blist","path":["age"],"value":"52"},{"name":"blist","path":["bday"],"value":"27/07/1963"},{"name":"blist","path":["nation"],"value":"NETHERLANDS"}]}]}
{"partition":{"key":["Allan DAVIS"],"position":310},"rows":[{"type":"row","position":383,"liveness_info":{"tstamp":"2018-03-19T22:35:57.430478Z"},"cells":[{"name":"blist","path":["age"],"value":"35"},{"name":"blist","path":["bday"],"value":"27/07/1980"},{"name":"blist","path":["nation"],"value":"AUSTRALIA"}]}]}
{"partition":{"key":["Laurence BOURQUE"],"position":384},"rows":[{"type":"row","position":460,"liveness_info":{"tstamp":"2018-03-19T22:35:57.441360Z"},"cells":[{"name":"blist","path":["age"],"value":"23"},{"name":"blist","path":["bday"],"value":"27/07/1992"},{"name":"blist","path":["nation"],"value":"CANADA"}]}]}