Cassandra 22 integration

56 views
Skip to first unread message

Chris

unread,
Aug 18, 2015, 4:11:16 PM8/18/15
to CMB User Forum
Hi!
I hope you all are having a great afternoon. I am new to CMB and have some questions. Is CMB compaitable with Cassandra22 and if so, is there a new schema template for it?

Thanks for the help in advance!

Christopher

boriwo

unread,
Aug 18, 2015, 6:29:32 PM8/18/15
to CMB User Forum
We tested the latest version of the schema (1.2) with Cassandra version 2.0.X and I would expect it to work with Cassandra 2.1/2.2 as well.

Chris

unread,
Aug 18, 2015, 8:44:53 PM8/18/15
to CMB User Forum
OK, I have been struggling using the cassandra_1.2.schema on my cassandra 2.2 install. I noticed the CQL syntax has been completely revamped. For instance, in order to create the table I had to run the following:

create keyspace CNS with replication={ 'class':'SimpleStrategy','replication_factor':1 };
create keyspace CQS with replication={ 'class':'SimpleStrategy','replication_factor':1 };
create keyspace CMB with replication={ 'class':'SimpleStrategy','replication_factor':1 };

and when I created the first table I had to change the syntax to the following:

create columnfamily CNSTopics (
  userId varchar,
  displayName varchar,
  name varchar,
  primary key (userId))
  with caching = { 'keys' : 'ALL' }
  and read_repair_chance = 0
  and dclocal_read_repair_chance = 0.05
  and replicate_on_write = true
  and compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
  ;

All of the above was created successfully however when I tried to create the second table it failed to create because there wasn't a column nor a primary key specified. Here is the output with the error:
cqlsh:cns> create columnfamily CNSTopicsByUserId (
       ... )
       ...   with caching = { 'keys' : 'ALL' }
       ...   and read_repair_chance = 0
       ...   and dclocal_read_repair_chance = 0.05
       ...   and replicate_on_write = true
       ...   and compaction = {'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
       ...   ;
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 2:0 no viable alternative at input ')' (create columnfamily CNSTopicsByUserId ([)]...)">

It looks like the file was generated to be used with the command cassandra-cli which has been deprecated in 2.2 and replaced with cqlsh

Should I try to use cassandra2.1?

Thanks for the help

Christopher Curts

boriwo

unread,
Aug 18, 2015, 9:41:02 PM8/18/15
to CMB User Forum
Yes, the script is for Cassandra CLI and I would recommend working with Cassandra 2.1 (which is currently the stable release anyways). Should you end up porting the CLI script to CQL, please do submit that as a pull request. Thanks!

boriwo

unread,
Sep 19, 2015, 12:58:02 AM9/19/15
to CMB User Forum
We now have a draft version of a CQL schema for you to try at

https://github.com/Comcast/cmb/blob/master/schema/cassandra_1.2.cql.schema


Reply all
Reply to author
Forward
0 new messages