Giter Club home page Giter Club logo

cassandra-tutorial's Introduction

Overview

This is a step-by-step tutorial designed to expose folks who might be new to Apache Cassandra to some more real-world examples of usage. This tutorial was initially put together a presentation I made at Data Day Austin in late January of 2011. It has been recently updated for Cassandra SF 2011.

This tutorial assumes you have a release of Apache Cassandra version 0.8.x running on your machine accessible via localhost:9160 (the default). All necessary keyspace creation scripts and data inserts are included.

Tutorial examples are designed to be run by Maven via the maven-exec-plugin. This makes dependency management a breeze (see the pom file!) and removes the need for goofy classpath maintenance scripts and such. An example of command invocation is in the Javadoc comment of each file. For example, to invoke the GetCityForNpanxx class, the following command should be used:

mvn -e exec:java -Dexec.args="get" -Dexec.mainClass="com.datastax.tutorial.TutorialRunner"

To execute the schema creation and import script use the following:

bin/cassandra-cli --host localhost < /path/to/script/npanxx_script.txt

This script creates a keyspace named 'Tutorial' and three column families:

  • StateCity: uses the state and city as a key. Column names are area codes, values are a concatenation of latitude and longitude
  • AreaCode: Uses the area code as a key, with the city ad NPA mapped to the latitude and longitude
  • Npanxx: Key is NPA and NXX concatenation. Column names static in that each row has the same number and type of columns

Have a look at npanxx_script.txt for more details - the contents are fairly straight forward. Even more so when you go through the tutorials.

The sample data used in this tutorial is taken from the North American Numbering Plan

I found my copy via [InfoChimps!](http://infochimps.com/datasets/area-code-and-exchange-to-location-north-america-

cassandra-tutorial's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.