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 ToddBlose. http://wiki.apache.org/cassandra/CassandraCli?action=diff&rev1=13&rev2=14 -------------------------------------------------- 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): {{{ + tbl...@quasar:~/dev/workspaces/cassandra$ bin/cassandra-cli -host localhost -port 9170 -username todd -keyspace Keyspace1 -password blah + Connected to: "Test Cluster" on localhost/9170 + Welcome to cassandra CLI. + + Type 'help' or '?' for help. Type 'quit' or 'exit' to quit. + [t...@keyspace1] + }}} + + + 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... + + {{{ + [defa...@unknown] use Keyspace1 todd 'blah$' + Authenticated to keyspace: Keyspace1 - cassandra> set Keyspace1.Standard2['jsmith']['first'] = 'John' + [t...@keyspace1] set Standard2['jsmith']['first'] = 'John' Value inserted. - cassandra> set Keyspace1.Standard2['jsmith']['last'] = 'Smith' + [t...@keyspace1] set Standard2['jsmith']['last'] = 'Smith' Value inserted. - cassandra> set Keyspace1.Standard2['jsmith']['age'] = '42' + [t...@keyspace1] set 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]]. + In the example above we authenticated to 'Keyspace1' and created a record in the `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: {{{ - cassandra> get Keyspace1.Standard2['jsmith'] + [t...@keyspace1] get Standard2['jsmith'] - => (column=last, value=Smith, timestamp=1259991884091) + => (column=last, value=Smith, timestamp=1271921526614000) - => (column=first, value=John, timestamp=1259991879010) + => (column=first, value=John, timestamp=1271921521923000) - => (column=age, value=42, timestamp=1259991135887) + => (column=age, value=42, timestamp=1271921532713000) Returned 3 results. - cassandra> }}} Note: Using the `get` command in this form is the equivalent to a `get_slice()` using the [[API|Thrift API]].