sstable2json

Converts the on-disk SSTable representation of a table into a JSON formatted document.

Warning: Please note that sstable2json is now deprecated and will be removed in Cassandra 3.0. Please see https://issues.apache.org/jira/browse/CASSANDRA-9618 for details.

Converts the on-disk SSTable representation of a table into a JSON formatted document. Converting SSTables this way is useful for testing and debugging.

DANGER: This tool is not recommended as a production tool and is not suitable for production operations!
Note: Starting with version 0.7, json2sstable and sstable2json must be run so that the schema can be loaded from system tables. This means that the cassandra.yaml file must be in the classpath and refer to valid storage directories. For more information, see the Import/Export section of http://wiki.apache.org/cassandra/Operations.

Procedure

Usage:
bin/sstable2json SSTABLE
   [-k KEY  [-k KEY  [... ]]]] [-x KEY  [-x KEY  [... ]]] [-e ]

SSTABLE should be a full path to a {table-name}-Data.db file in Cassandra’s data directory. For example, /var/lib/cassandra/data/Keyspace1/Standard1-e-1-Data.db.

  • -k allows you to include a specific set of keys. The KEY must be in HEX format. Limited to 500 keys.
  • -x allows you to exclude a specific set of keys. Limited to 500 keys.
  • -e causes keys to only be enumerated.

The output is:

{
   ROW_KEY:
   {
     [
       [COLUMN_NAME, COLUMN_VALUE, COLUMN_TIMESTAMP, IS_MARKED_FOR_DELETE],
       [COLUMN_NAME, ... ],
       ...
     ]
   },
   ROW_KEY:
   {
     ...
   },
   ...
}

Row keys, column names and values are written in as the HEX representation of their byte arrays. Line breaks are only in between row keys in the actual output.

Related topics

cassandra.yaml configuration file