简体   繁体   中英

What is the fastest way to copy Column family in Cassandra?

I want to create copy of Column Family with another name in Cassandra using Hector(or any other client), Is there any fastest way to do this?

Thanks

The cassandra hadoop integration reads a whole column family to use as input to a map reduce job; it can also output in bulk to a column family. Have a read of the code in the org.apache.cassandra.hadoop package to get an idea of what to do.

For the read, it figures out which tokens are on which nodes and then does a get_range_slice using that token range (it splits up the token range into manageable chunks too). For the write it does (or can do if you use the Bulk* classes) a similar thing to the above solutions by constructing an SSTable and then uploading that to cassandra.

I suspect the other answers above using sstable2json would be far and away more efficient, but this would work.

您可以使用sstable2json将其读出,然后使用json2sstable将其写回新的CF。

My answer was going to involve iterating row by row which you say you already are doing. My only improvement over that is to use a KeySlice to get multiple keys, and therefore multiple rows, per request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM