Created
May 10, 2011 06:07
-
-
Save msabramo/963985 to your computer and use it in GitHub Desktop.
Transcript of using cassandra-cli and pycassa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 09:10:46 $ cassandra-cli | |
| Welcome to cassandra CLI. | |
| Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit. | |
| [default@unknown] ? | |
| List of all CLI commands: | |
| ? Display this message. | |
| help; Display this help. | |
| help <command>; Display detailed, command-specific help. | |
| connect <hostname>/<port> (<username> '<password>')?; Connect to thrift service. | |
| use <keyspace> [<username> 'password']; Switch to a keyspace. | |
| describe keyspace (<keyspacename>)?; Describe keyspace. | |
| exit; Exit CLI. | |
| ... | |
| [default@unknown] connect 127.0.0.1/9160; | |
| Connected to: "Test Cluster" on 127.0.0.1/9160 | |
| [default@unknown] show keyspaces; | |
| Keyspace: system: | |
| ... | |
| [default@unknown] create keyspace marc_test; | |
| ac536549-7410-11e0-97ba-e700f669bcfc | |
| Waiting for schema agreement... | |
| ... schemas agree across the cluster | |
| [default@unknown] use marc_test; | |
| Authenticated to keyspace: marc_test | |
| [default@marc_test] create column family people; | |
| 72121b5a-7411-11e0-97ba-e700f669bcfc | |
| Waiting for schema agreement... | |
| ... schemas agree across the cluster | |
| [default@marc_test] set people['marc']['firstName'] = Marc; | |
| Value inserted. | |
| [default@marc_test] get people['marc']['firstName']; | |
| => (column=66697273744e616d65, value=Marc, timestamp=1304268084092000) | |
| [default@marc_test] get people['marc']['firstName'] as ascii; | |
| => (column=66697273744e616d65, value=Marc, timestamp=1304268084092000) | |
| [default@marc_test] create column family mmc; | |
| ad723b6b-7413-11e0-97ba-e700f669bcfc | |
| Waiting for schema agreement... | |
| ... schemas agree across the cluster | |
| [default@marc_test] set mmc[1]['firstName'] = 'Mickey'; | |
| Value inserted. | |
| [default@marc_test] set mmc[1]['lastName'] = 'Mouse'; | |
| Value inserted. | |
| [default@marc_test] set mmc[2]['firstName'] = 'Donald'; | |
| Value inserted. | |
| [default@marc_test] set mmc[2]['lastName'] = 'Duck'; | |
| Value inserted. | |
| [default@marc_test] list mmc; | |
| Using default limit of 100 | |
| ------------------- | |
| RowKey: 2 | |
| => (column=66697273744e616d65, value=446f6e616c64, timestamp=1304268941147000) | |
| => (column=6c6173744e616d65, value=4475636b, timestamp=1304268951382000) | |
| ------------------- | |
| RowKey: 1 | |
| => (column=66697273744e616d65, value=4d69636b6579, timestamp=1304268898541000) | |
| => (column=6c6173744e616d65, value=4d6f757365, timestamp=1304268921517000) | |
| 2 Rows Returned. | |
| [default@marc_test] get mmc[1]['firstName']; | |
| => (column=66697273744e616d65, value=4d69636b6579, timestamp=1304268898541000) | |
| [default@marc_test] get mmc[1]['firstName'] as ascii; | |
| => (column=66697273744e616d65, value=Mickey, timestamp=1304268898541000) | |
| [default@marc_test] get mmc[1]['lastName'] as ascii; | |
| => (column=6c6173744e616d65, value=Mouse, timestamp=1304268921517000) | |
| [default@marc_test] get mmc[2]['firstName'] as ascii; | |
| => (column=66697273744e616d65, value=Donald, timestamp=1304268941147000) | |
| [default@marc_test] get mmc[2]['lastName'] as ascii; | |
| => (column=6c6173744e616d65, value=Duck, timestamp=1304268951382000) | |
| 07:52:23 $ cat pycassa-example.py | |
| #!/usr/bin/env python | |
| import pycassa | |
| pool = pycassa.connect('marc_test') | |
| cf = pycassa.ColumnFamily(pool, 'mmc') | |
| print cf.get('1') | |
| print cf.get('2') | |
| (pycassa) | |
| marc@hyperion:~/python/virtualenvs/pycassa/code | |
| 07:52:25 $ ./pycassa-example.py | |
| OrderedDict([('firstName', 'Mickey'), ('lastName', 'Mouse')]) | |
| OrderedDict([('firstName', 'Donald'), ('lastName', 'Duck')]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment