Domanda

I need to copy a ColumnFamily in the same keyspace -- I don't care for the data in this ColumnFamily, just the CF's meta-data (properties, settings, etc -- whatever you'd like to call it).

I can't find anything online that describes this process (neither can I find whether it's possible or not).

Any suggestions/ideas?

I can use python or java (astyanax or hector). Also, I'm running cassandra 1.1

Thanks!

È stato utile?

Soluzione

You need to get the schema for the existing column family, then create one with exactly the same settings apart from a different name. You can easily do this in cassandra-cli with

use keyspace;
show schema;

then copy the schema for the column family you want to copy, change the name and paste it in.

Or if using CQL, you can use the same approach from cqlsh or a CQL driver.

You can also do it in Hector. Use Cluster.describeKeyspace() to get the KeyspaceDefinition for your keyspace. Then find the column family you want to copy in the list from getCfDefs(). Change its name with setName and create it with Cluster.addColumnFamily.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top