Skip to content

Instantly share code, notes, and snippets.

@bartprokop
Created July 16, 2012 07:19
Show Gist options
  • Save bartprokop/3121324 to your computer and use it in GitHub Desktop.
Save bartprokop/3121324 to your computer and use it in GitHub Desktop.
Creating namespace with Cassandra
public static void main(String... args) {
Cluster cluster = HFactory
.getOrCreateCluster("test-cluster", "localhost:9160");
ColumnFamilyDefinition cfDef = HFactory
.createColumnFamilyDefinition("MyKeyspace", "ColumnFamilyName", ComparatorType.BYTESTYPE);
KeyspaceDefinition newKeyspace = HFactory
.createKeyspaceDefinition("MyKeyspace", ThriftKsDef.DEF_STRATEGY_CLASS, 1,
Arrays.asList(cfDef));
cluster.addKeyspace(newKeyspace, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment