Search code examples
cassandradatastax-enterprisedatastax

Migrate data from cassandra to cassandra


We have 2 cassandra clusters, first one has the old data and second one has the new data.

Now we want to move or copy the old data from first cluster to second. What is the best way to do this and how to do this?

we are using DSE 3.1.4.


Solution

  • One tool you could try would be the COPY TO/FROM cqlsh command.

    On a node in the old cluster, you would use the COPY TO:

    cqlsh> COPY myTable (col1, col2, col3, col4) TO 'temp.csv'
    

    And then (after copying the file over) on a node in your new cluster, you would copy the data in the CSV file into Cassandra:

    cqlsh> COPY myTable (col1, col2, col3, col4) FROM 'temp.csv'
    

    Here is some more documentation on the COPY command.

    Note that the COPY TO/FROM is recommended for tables that contain only a few million rows or less. For larger datasets you should look at: