Hi everyone.

I’m having a bit of a problem getting started with 0.7

I had 0.6.4 working and I want to start checking out 0.7, I can’t figure out how to create keyspaces to even get started.

Can anyone also give me a little info on secondary index’s, their purpose and use

 

The following is the java code I was using

public class Client {

      private static TTransport tr = null;

      private static Cassandra.Client client = null;

      public static Client Cassandra = new Client();

 

      public Client() {

            setupConnection();

      }

 

      private static void setupConnection() {

            try {

                  tr = new TSocket("localhost", 9160);

                  TProtocol proto = new TBinaryProtocol(tr);

                  client = new Cassandra.Client(proto);

                  tr.open();

            } catch (TException ex) {

                  Logger.getLogger(Client.class.getName()).log(Level.ALL, null, ex);

            }

      }

      public static void main(String[] args) throws InvalidRequestException, TException {

            KsDef ks = new KsDef();

            CfDef cf = new CfDef();

            cf.setColumn_type("Standard");

            cf.setName("Standard1");

            cf.setKeyspace("Keyspace1");

            List<CfDef> cl = new ArrayList<CfDef>();

            cl.add(cf);

            ks.setReplication_factor(1);

            ks.setStrategy_class("org.apache.cassandra.locator.RackUnawareStrategy");

            ks.setName("Keyspace1");

            ks.setCf_defs(cl);

            Client.Cassandra.client.system_add_keyspace(ks);

 

      }

 

}

 

But of course it throws an exception:

 

Exception in thread "main" org.apache.thrift.transport.TTransportException

      at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)

      at org.apache.thrift.transport.TTransport.readAll(TTransport.java:84)

      at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:369)

      at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:295)

      at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:202)

      at org.apache.cassandra.thrift.Cassandra$Client.recv_system_add_keyspace(Cassandra.java:1454)

      at org.apache.cassandra.thrift.Cassandra$Client.system_add_keyspace(Cassandra.java:1439)

      at org.shotaz.Cassandra.Client.main(Client.java:58)

 

I’ve seen http://wiki.apache.org/cassandra/LiveSchemaUpdates  and http://wiki.apache.org/cassandra/API (CFdef and KSDef section)

But I still can’t suss it any help/pointers would be much appreciated.

P.S I also used Hector with 0.6.4 so examples using either thrift or Hector should get me going.

 

thanks