Iliya Karin
Iliya Karin

Reputation: 11

How to copy/migrate data from one keyspace to another in cassandra?

I need to copy data from keyspace database1 to keyspace database18.

It's not an option to use csql COPY command (at least I don't know how to make such script), because I have 103 different tables with all imaginable columns in it.

Keyspaces already created, schema applied.

I already tried to make a snapshot and then copy (mv)

1. mv /data/cassandra/data/database1/tables/snapshot/copy/* /data/cassandra/data/database18/tables/*

  1. nodetool refresh database18 tablesOneByOne
  2. nodetool repair database18

I also tried to reboot one of my servers:

  1. nodetool disablegossip

  2. nodetool drain

  3. reboot

There are no data in new keyspace tables.

When I enter csql use database18; select * from table1;

I receive an empty table "(0 rows)"

Cassandra version is: [cqlsh 5.0.1 | Cassandra 2.1.17.1439

Maybe there something I missing or different way exists to achieve this?

Any help or suggestions are welcome, thank you!!!

Upvotes: 1

Views: 1114

Answers (1)

Jim Wartnick
Jim Wartnick

Reputation: 2196

I guess your options are: 1) cql copy and/or dse bulk 2) sstableloader 3) code 4) 3rd party product (we have a product for backing up and restoring - and can do so to different clusters, if desired (Formerly Talena, Formerly Imanis, Now Cohesity)

If the tables are large, and the node-count is small, I would say use sstableloader. Works well.

-Jim

Upvotes: 2

Related Questions