Example on creating a new KeySpace

Mar 14, 2012 at 7:01 AM

I hope there is some more documentation you guys can bring up ahead.

Your product is very flexing as compared to FOUR other .NET clients I have tried so far. 

If you can post a sample here or on the main documentation for creating new KeySpaces.

 

Thank you

Coordinator
Mar 14, 2012 at 11:45 PM

You can show sample in follwoing code.

KsDef and CfDef are class in thrift api.

 

using(Context = new CassandraContext(host, port, "system"))
{
    var cfDef = new CfDef();
    cfDef.Keyspace = "ks1";
    cfDef.Name = "cf1";
    cfDef.Column_type = "Standard";
    cfDef.Comparator_type = "IntegerType";

    var cfDefList = new List<CfDef>();
    cfDefList.Add(cfDef);
       
    var ksDef = new KsDef();
    ksDef.Name = "ks1";
    ksDef.Strategy_class = "org.apache.cassandra.locator.SimpleStrategy";
    ksDef.Replication_factor = 1;
    ksDef.Cf_defs = cfDefList;
       
    Context.SystemAddKeyspace(ksDef);

Mar 15, 2012 at 5:24 AM

Thank you. Just what was needed :)