Dumping/Loading Schema in Cassandra
This handy command line will dump a schema from Cassandra:
echo -e "use your_keyspace;\r\n show schema;\n" | bin/cassandra-cli -h localhost > mySchema.cdlI always forget the "-e" on echo, which is why I thought I would blog this. We've started using ".cdl" as the extension, short for "Cassandra DDL".
Coincidentally, you can then load it with:
bin/cassandra-cli -h localhost -f mySchema.cdlHope people find this useful.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)