Question

I am using DataStax Cassandra Community Edition on Windows 8. I am following the documentation at - http://www.datastax.com/2012/01/getting-started-with-apache-cassandra-on-windows-the-easy-way

In Windows, there are two command line utilities 1. CLI and 2. CQL Shell. The syntax for both of them differ e.g. you can see from the help menu that, to create a keyspace, CLI => create keyspace, while on CQL Shell => CREATE_KEYSPACE

However, as per the documentation, the following line works well in CQL Shell while giving exception in the CLI utility.

create keyspace hr with replication={'class':'SimpleStrategy', 'replication_factor':1};

Is this a discrepancy? "create keyspace" style statement should work in CLI as given in its helps menu, but it works in CQL Shell where the syntax in the help menu is CREATE_KEYSPACE.

Was it helpful?

Solution

The CREATE KEYSPACE statement looks similar in CLI and CQL. The statement you used is valid CQL (see the CQL documentation on CREATE KEYSPACE):

CREATE KEYSPACE hr WITH replication={'class':'SimpleStrategy', 'replication_factor':1};

The equivalent statement in CLI would be:

CREATE KEYSPACE hr WITH placement_strategy = 'SimpleStrategy' AND strategy_options = {replication_factor:1};

There is no CREATE_KEYSPACE in either CLI or CQL. That's just the way the help documentation works (spaces are replaced with underscores). See also, for example the SELECT_EXPR entry in the help documentation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top