Apache Wiki
Sat, 13 Mar 2010 08:15:55 -0800
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 szeldon. http://wiki.apache.org/cassandra/CassandraCli?action=diff&rev1=11&rev2=12 -------------------------------------------------- - 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. + 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. @@ -12, +12 @@ Type 'help' or '?' for help. Type 'quit' or 'exit' to quit. cassandra> }}} + (If you are using SimpleAuthenticator (instead of AllowAllAuthenticator) you can specify the username, password and keyspace by adding the following options to cassandra-cli: -username username -password password -keyspace keyspace) 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... - (If you are using SimpleAuthenticator (instead of AllowAllAuthenticator) you can specify the username, password and keyspace by adding the following options to cassandra-cli: -username username -password password -keyspace keyspace) - 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 Keyspace1.Standard2['jsmith']['first'] = 'John' Value inserted. - cassandra> set Keyspace1.Standard2'jsmith']['last'] = 'Smith' + cassandra> set Keyspace1.Standard2['jsmith']['last'] = 'Smith' Value inserted. cassandra> set Keyspace1.Standard2['jsmith']['age'] = '42' Value inserted. }}} - 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 let's read back the `jsmith` row to see what it contains: @@ -38, +34 @@ Returned 3 results. cassandra> }}} - Note: Using the `get` command in this form is the equivalent to a `get_slice()` using the [[API|Thrift API]].