cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Cassandra Wiki] Update of "CassandraCli" by EricEvans
Date Wed, 09 Dec 2009 22:43:52 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cassandra Wiki" for change notification.

The "CassandraCli" page has been changed by EricEvans.
The comment on this change is: cleanup.


- The CLI is a simple java program that lets you connect to a Cassandra server and interactively
store and retrieve data.
- After starting the Cassandra server, launch the CLI using:
+ Cassandra ships with a very basic interactive command line interface, or shell. Using the
CLI you can connect to remote nodes in the cluster, set and retrieve records and columns,
or query node and cluster meta-data (i.e. cluster name, keyspace listings and disposition,
etc). The CLI is handy for quick tests or for familiarizing yourself with the data-model.

+ You can start the CLI using the `bin/cassandra-cli` startup script.
- ./bin/cassandra-cli -host localhost -port 9160
+ evans@achilles:~/cassandra$ bin/cassandra-cli -host localhost -port 9160
- }}}
- You should see:
- {{{
  Connected to localhost/9160
  Welcome to cassandra CLI.
@@ -23, +20 @@

  cassandra> set Keyspace1.Standard1['jsmith']['first'] = 'John'
  Value inserted.
- cassandra> set Keyspace1.Standard1['jsmith']['last'] = 'Simmons'
+ cassandra> set Keyspace1.Standard1['jsmith']['last'] = 'Smith'
  Value inserted.
  cassandra> set Keyspace1.Standard1['jsmith']['age'] = '42'
  Value inserted.
- We just added a key `jsmith` and three columns (`first`, `last`, and `age`) to the `Standard1`
column family. (Check out DataModel for a primer on the Table abstraction provided by Cassandra
if these terms don't make sense just yet.)
+ In the example above we created a record in the `Keyspace1` keyspace and `Standard1` column
family using the key `jsmith`. This record has three columns, `first`, `last`, and `age`.
Each of these commands is the equivalent to an `insert()` using the [[API|Thrift API]].
- Now we read back the `jsmith` row to see what it contains:
+ Now let's read back the `jsmith` row to see what it contains:
  cassandra> get Keyspace1.Standard1['jsmith']
@@ -42, +39 @@

+ Note: Using the `get` command in this form is the equivalent to a `get_slice()` using the
[[API|Thrift API]].

View raw message