What is the best solution for backing up data in Cassandra?
migrated from stackoverflow.com Jun 5 '11 at 5:04
This question came from our site for professional and enthusiast programmers.
closed as not constructive by Mark Henderson♦ Jan 15 '12 at 6:00
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
There are several different options available, and it really depends on your situation which is best, but here's a quick overview of the techniques available.
There are basically two things you are trying to protect against when backing up a data store:
Cassandra has data replication built into it's design. The replication factor configuration option tell cassandra how many copies of each record to store. A common choice for replication factor is 3 because it strikes a decent trade off between performance and durability. If you have a replication factor greater than one, you can withstand the loss of at least some nodes. There's a lot more to say on this subject, but you can read about that elsewhere.
Replication doesn't protect you against bad data changes through the API, though, since massive deletes will replicate the same as good inserts. To help you with this, cassandra offers a snapshotting feature. Basically, it hard links the data files to a snapshots folder within the data directory. This can be a pretty inexpensive approach depending on how frequently and randomly your data changes. One possible approach is to keep multiple snapshots on the disks of the cassandra machines, provided you have enough space.
If you have spare IO capacity, you could actually transfer those backups to separate machines. In my experience, this takes great a toll on both disk and network throughput.
Finally, as of Cassandra 0.7, you can configure multi-datacenter replication. Essentially, you can have multiple copies of your cluster distributed throughout the world. If you combine this with snapshots, you have quite a few different options for restoring your data when something goes wrong.
Remember that you get 1 point for making a backup and 10,000 points for restoring one. Think about how you will test your backups to make sure they can actually be restored when the time comes.