Anastasia Osintseva
Anastasia Osintseva

Reputation: 100

Import all existing keyspaces schemas

I have 6 keyspaces in cassandra database. I want to migrate all my keyspaces schemas in another cassandra database. How can I do it at once?

Upvotes: 0

Views: 66

Answers (2)

undefined_variable
undefined_variable

Reputation: 6218

You can run following command to write the scema in cql file

cqlsh -e "Desc keyspace keyspacename" > 'out.cql'

and then use SOURCE to import cql file on another host OR cqlsh -f out.cql optionalHostname

Upvotes: 1

mikea
mikea

Reputation: 6667

DESCRIBE SCHEMA;

will give you DDL statements needed to recreate the non-system keyspaces and tables on a new cluster.

Upvotes: 1

Related Questions