Skip to content

Example of using Java to access Cassandra with Hector and Astyanax libraries

Notifications You must be signed in to change notification settings

linshimiao/Cassandra-Client-Tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cassandra Client Tutorial, Copyright 2012 Joe McTee

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http:www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Project includes three examples of how to access a Cassandra data store using Java.

The model for the data we want to store is based on a set of atmospheric sensors that collect time series data collected on a reasonably quick interval (minutes). The fields of the modeled entity have been chosen to demonstrate how to store heterogeneous data types (most examples just use strings, boring).

A set of slides and a video presentation will be forthcoming for this project. This README will be updated with links.

Example 1: Accessing a datastore that uses Cassandra super columns to store the various fields of the entity using the Hector library.

Example 2: Accessing a datastore that uses normal Cassandra columns, packing the entity in a protocol buffer using the Hector library.

Example 3: Accessing a datastore that uses normal Cassandra columns, packing the entity in a protocol buffer using the Astyanax library and asynchronous API.

To run this example (assumes you have Maven 3 installed):

Clone the repo on your local machine
At the top level of the project, run:

> mvn clean install

All tests should pass. Review tests to see how to use the examples.

A PDF version of the slides for the presentation that goes with this code can be found in the slides directory. In addition, the slides can be viewed at http://www.slideshare.net/jmctee/cassandra-clienttutorial.

Note: To run these examples, you do no need to install Cassandra, as the tests use embedded Cassandra. The preso will cover how to use these examples with a non-embedded Cassandra instance.

More to come, hope this is helpful...

Joe

About

Example of using Java to access Cassandra with Hector and Astyanax libraries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.0%
  • Protocol Buffer 1.0%