Neron Joseph
Neron Joseph

Reputation: 2365

How to take data from cassandra with limit or data of the last 30 days

I'm working on Apache Cassandra DB and I want to take a backup of the last 30 days data from an existing Cassandra DB and want to import it to other Cassandra DB. I've found out that we can take backup using COPY command of CQLSH. But we can't provide limit it that. Is there a way to take the backup of the last 30 days or with any limit on Cassandra?

Any help is really appreciated.

Upvotes: 0

Views: 121

Answers (1)

stevenlacerda
stevenlacerda

Reputation: 466

CQLSH is not a backup tool. If you're looking to just copy data out then you could use a date column within your table or use writetime and something like spark to pull the data out.

If you want a real backup solution, then use something like medusa which is a backup tool for Cassandra. That will allow you to set a schedule and do real backups, however, you won't be able to tell it to take a backup of data from 30 days ago. You'll take a backup, which will have all of the data, then in 30 days you can take another backup and drop the first one if you'd like or restore the first backup you made to your other cluster.

https://github.com/thelastpickle/cassandra-medusa

Upvotes: 1

Related Questions