Ztyx
Ztyx

Reputation: 14908

What is necessary to backup the schema?

The Datastax documentation states

Cassandra can only restore data from a snapshot when the table schema exists. If you have not backed up the schema, [...]

What is required for a full backup of the schema? Simply backing up the system keyspace?

Upvotes: 1

Views: 370

Answers (2)

LHWizard
LHWizard

Reputation: 2379

There's no need to backup the system keyspaces, they will be recreated when DSE is installed on the new node. However, you'll need the schema for any user-defined keyspaces.

To backup the schema:

$ cqlsh -e "DESCRIBE SCHEMA;" > schema.out

To restore on a new node:

$ cqlsh < schema.out

Upvotes: 2

Adam Holmberg
Adam Holmberg

Reputation: 7365

In cqlsh (included with Cassandra), use the DESC SCHEMA command.

    DESCRIBE [FULL] SCHEMA

      Output CQL commands that could be used to recreate the entire (non-system) schema.
      Works as though "DESCRIBE KEYSPACE k" was invoked for each non-system keyspace
      k. Use DESCRIBE FULL SCHEMA to include the system keyspaces.

Upvotes: 2

Related Questions