sstable2json

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

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

CAUTION: 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.

Procedure

Usage:
  • Cassandra Package installations:
    sstable2json SSTABLE [-k KEY  [-k KEY  [... ]]]] [-x KEY  [-x KEY  [... ]]] [-e ]
  • Cassandra Tarball installations:
    cd install_location/tools
    $ 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

The cassandra.yaml configuration file