K M Dilshan Udara
K M Dilshan Udara

Reputation: 1195

How to get Cassandra database dump with data

I need to get a dump(with data) from remote Cassandra database. I was able to get database schema via following command.How can i get all data in the keyspace?

I'm using Cassandra 1.1.9

echo -e "connect localhost/9260;\r\n use PWC_Keyspace;\r\n show schema;\n" | bin/cassandra-cli -h localhost -port 9260 > dilshan.cdl

Upvotes: 1

Views: 2190

Answers (1)

Jeff Jirsa
Jeff Jirsa

Reputation: 4426

With Cassandra 1.1.9, I don't believe you have access to cqlsh with the copy-to command, so you'll be stuck with 2 options.

1) Export the data from the data files (sstables) on disk using sstable2json, or 2) Write a program to iterate over every row and copy/serialize it to a format you find easier to work with.

You MAY be able to use a more recent cqlsh (say, from 2.0, which still used thrift instead of the native interface), and point it at your 1.1.9 server and use 'COPY TO' to export each table to a csv. However, the COPY command in cqlsh for 2.0 doesn't use paging, and cassandra 1.1.19 doesn't support paging, so there's a very good chance it's simply going to time out and fail.

Upvotes: 1

Related Questions