You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by Apache Wiki <wi...@apache.org> on 2009/05/12 22:42:19 UTC

[Cassandra Wiki] Update of "CassandraCli" by SandeepTata

Dear Wiki user,

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

The following page has been changed by SandeepTata:
http://wiki.apache.org/cassandra/CassandraCli

The comment on the change is:
CLI tutorial from README

New page:
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:

  * `bin/cassandra-cli --host localhost --port 9160`

You should see:
{{{
  Connected to localhost/9160
  Welcome to cassandra CLI.
  
  Type 'help' or '?' for help. Type 'quit' or 'exit' to quit.
  cassandra>
}}}

As the banner says, you can use 'help' or '?' to see what the CLI has to
offer, and 'quit' or 'exit' when you've had enough fun. But lets try
something slightly more interesting...

{{{
  cassandra> set Table1.Standard1['jsmith']['first'] = 'John'
  Statement processed.
  cassandra> set Table1.Standard1['jsmith']['last'] = 'Smith' 
  Statement processed.
  cassandra> set Table1.Standard1['jsmith']['age'] = '42'
  Statement processed.
}}}

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.)

Now we read back the `jsmith` row to see what it contains:

{{{
  cassandra> get Table1.Standard1['jsmith']
  COLUMN_TIMESTAMP = 1241129773658; COLUMN_VALUE = 42; COLUMN_KEY = age;
  COLUMN_TIMESTAMP = 1241129537336; COLUMN_VALUE = Smith; COLUMN_KEY = last; 
  COLUMN_TIMESTAMP = 1241129520503; COLUMN_VALUE = John; COLUMN_KEY = first; 
  Statement processed.
  cassandra>
}}}