Saturday, January 18, 2014

Connecting to Cassandra Keyspaces Created by WSO2 BAM using CQL3 Commands

Here, I'm going to explain how to connect to Cassandra Keyspaces created by WSO2 BAM using CQL 3 Commands.

Most people able to connect to Cassandra Keypaces using CQL2 commands, but fail by using CQL3 commands. That is because, in CQL3, names are case insensitive by default, while they were case sensitive in CQL2. So you have to force whatever case you want in CQL3 by using double quotes.


You will be able to connect to Cassandra Keyspaces by using following sequence of commands.


..:/apache-cassandra-1.2.4/bin$ ./cqlsh -3 localhost 9160 -u admin -p admin
Connected to Test Cluster at localhost:9160.
[cqlsh 2.3.0 | Cassandra 1.1.3 | CQL spec 3.0.0 | Thrift protocol 19.32.0]
Use HELP for help.
cqlsh> use EVENT_KS;
cqlsh:EVENT_KS> select * from bam_mediation_stats_data_publisher;
Bad Request: Keyspace event_ks does not exist
Perhaps you meant to use CQL 2? Try using the -2 option when starting cqlsh.
cqlsh:EVENT_KS> USE "EVENT_KS";
cqlsh:EVENT_KS> select * from bam_mediation_stats_data_publisher;

key                                    | Description                      | Name                               | Nick_Name               | StreamId                                 | Timestamp     | Version | meta_host | payload_avg_processing_time | payload_count | payload_direction | payload_fault_count | payload_max_processing_time | payload_min_processing_time | payload_resource_id                 | payload_stats_type | payload_timestamp
----------------------------------------+----------------------------------+------------------------------------+-------------------------+------------------------------------------+---------------+---------+-----------+-----------------------------+---------------+-------------------+---------------------+-----------------------------+-----------------------------+-------------------------------------+--------------------+-------------------
1384321342409::10.100.0.40::9443::1232 | A sample for Mediator Statistics | bam_mediation_stats_data_publisher | MediationStatsDataAgent | bam_mediation_stats_data_publisher:1.0.0 | 1384321342409 |   1.0.0 | 127.0.0.3 |                       915.5 |             1 |                In |                   0 |                        1270 |                         561 |    Simple_Stock_Quote_Service_Proxy |              Proxy |     1386174113944

No comments:

Post a Comment