Question

I'm try to export data from cassandra using sstable2json but when i try to run the command

sstable2json /var/lib/cassandra/data/S2B_development/users-g-110-Data.db

an error occurs

log4j:WARN No appenders could be found for logger (org.apache.cassandra.config.DatabaseDescriptor). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. no non-system tables are defined Exception in thread "main" org.apache.cassandra.config.ConfigurationException: no non-system tables are defined at org.apache.cassandra.tools.SSTableExport.main(SSTableExport.java:414)

cassandra version: 0.8

Was it helpful?

Solution

Example of how to get output from sstable2json

For the benefit of other developers:

1. Start Cassandra
2. Fire up cqlsh
3. Create a keyspace:

CREATE KEYSPACE test WITH replication = 
    {'class': 'SimpleStrategy', 'replication_factor': 1};

4. Create a CF

CREATE TABLE test.test2
(
  key varchar PRIMARY KEY, 
  string varchar, 
  number int, 
  flag boolean
);

5. Populate the CF with a key (or lots of keys...)

INSERT INTO test.test2 (key, string, number, flag)
VALUES ('first_key', 'varchuuur', 312, false);

6. Flush the data (so it gets saved from the memtable into an sstable)
7. Stop Cassandra
8. run sstable2json

./bin/sstable2json /var/lib/cassandra/data/test/test2/test-test2-jb-1-Data.db;

Output:

[
  {
    "key": "66697273745f6b6579","columns": 
    [
      ["","",1378042590383000], 
      ["flag","true",1378042590383000], ["number","312",1378042590383000], 
      ["string","varchuuur",1378042590383000]
    ]
  }
]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top