Showing posts with label Cassandra. Show all posts
Showing posts with label Cassandra. Show all posts

Friday, January 18, 2013

Getting started with Cassandra on Windows

Running Cassandra on Windows: step by step presentation

...follow below steps to successfully setup and run sample test case...

1. Download Cassandra from http://cassandra.apache.org/download/​

2. unzip under C:\cassandra\apache-cassandra-0.7.8

3. set CASSANDRA_HOME=C:\cassandra\apache-cassandra-0.7.8 and make sure JAVA_HOME​ is already set.

4. modify config/cassandra.yaml

  and change all the directories to windows. e.g.
--------------------------------------------------------------------------------

data_file_directories:

- C:/tools/apache-cassandra-0.7.8/data/data
commitlog_directory: C:/tools/apache-cassandra-0.7.8/data/commitlog

saved_caches_directory: C:/tools/apache-cassandra-0.7.8/data/saved_caches

--------------------------------------------------------------------------------


now create below folders under C:/tools/apache-cassandra-0.7.8/data/:

 

callouts, bootstrap, staging, saved_caches, commitlog, data

-these folders are used for diferent purposes.

5. run cassandra.bat  - it runs cassandra server

6. run cassandra-cli.bat -it runs client console

execute below in client console:
__________________________________________

get sample user details from config/password.properties

e.g.   jsmith=havebadpass

connect using connect 127.0.0.1/9160

or

connect 127.0.0.1/9160  jsmith 'havebadpass';

or

c:\cassandra\apache-cassandra-0.7.8\bin>cassandra-cli.bat  --host localhost

----------------------------------------------------------------------------------------

 

Starting Cassandra Client

Welcome to cassandra CLI.

Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit.

[default@unknown] 

===========Connect to Cassandra server===============

[default@unknown] connect 127.0.0.1/9160  jsmith 'havebadpass';

Connected to: "Test Cluster" on 127.0.0.1/9160

[jsmith@unknown] connect 127.0.0.1/9160;

Connected to: "Test Cluster" on 127.0.0.1/9160

===========Create KeySpace===============

[jsmith@unknown] create keyspace Twissandra;

b97c69f2-bc7c-11e0-84c7-e700f669bcfc

Waiting for schema agreement...

... schemas agree across the cluster

===========Set KeySpace===============

[jsmith@unknown] use Twissandra;

Authenticated to keyspace: Twissandra

===========Create Column Family 'user'===============

[default@Twissandra] create column family User with comparator = UTF8Type;

c273cb23-bc7c-11e0-84c7-e700f669bcfc

Waiting for schema agreement...

... schemas agree across the cluster

===========Insert Sample User 'jsmith'===============

[default@Twissandra] set User['jsmith']['first'] = 'John';

Value inserted.

===========Fetch Sample User 'jsmith'===============

[default@Twissandra]  get User['jsmith'];

=> (column=first, value=4a6f686e, timestamp=1312230501056000)

Returned 1 results.

[default@Twissandra]

----------------------------------------------------------------------------------------​

__________________________________________

 

More details on executing sample queries can be found at:http://wiki.apache.org/cassandra/CassandraCli

Or you could refer my previous post @ useful-bookmarks-on-cassandra

 

Tuesday, January 15, 2013

Useful bookmarks on Cassandra

Cassandra Links...