Cassandra sstable2json不起作用

时间:2013-09-04 16:51:24

标签: debugging nosql cassandra data-export

我尝试使用sstable2json从cassandra导出数据但是当我尝试运行命令时

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

发生错误

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版本:0.8

1 个答案:

答案 0 :(得分:2)

如何从sstable2json

获取输出的示例

为了其他开发者的利益:

1。启动Cassandra
  2。启动cqlsh
  3。创建密钥空间:

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

4. 创建CF

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

5. 使用密钥(或许多密钥......)填充CF

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

6. :刷新数据(以便将其从记忆中保存到sstable中)
  7。停止Cassandra
  8。运行sstable2json

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

输出:

[
  {
    "key": "66697273745f6b6579","columns": 
    [
      ["","",1378042590383000], 
      ["flag","true",1378042590383000], ["number","312",1378042590383000], 
      ["string","varchuuur",1378042590383000]
    ]
  }
]