All Products
Search
Document Center

Migrate data by running Copy commands

Last Updated: Mar 11, 2021

This topic describes how to run Copy commands to migrate data. For more information about Copy commands, see Copy commands.

Procedure

  1. To export data from the source cluster to a CSV file, connect to the source cluster and execute the following statement in cqlsh:

COPY table_name [( column_list )]
TO 'file_name'[, 'file2_name', ...] ;

After the statement is executed, the data is exported to the file that is specified in the statement.

2. To import the CSV file to the target cluster, connect to the target cluster and execute the following statement in cqlsh:

COPY table_name [( column_list )]
FROM 'file_name'[, 'file2_name', ...] ;

After the statement is executed, the data is imported to the target cluster.