Fetch all rows in cassandra

后端 未结 3 1904
小蘑菇
小蘑菇 2020-12-03 17:34

I have a cassandra table containing 3 million rows. Now I am trying to fetch all the rows and write them to several csv files. I know it is impossible to perform selec

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 18:20

    You could use Pig to read the data and store it into HDFS, then copy it out as a single file:

    In Pig:

    data = LOAD 'cql://your_ksp/your_table' USING CqlStorage();
    STORE data INTO '/path/to/output' USING PigStorage(',');
    

    From OS shell:

    hadoop fs -copyToLocal hdfs://hadoop_url/path/to/output /path/to/local/storage
    

提交回复
热议问题