development nirvana with cassandra
TRANSCRIPT
Who am I and what do I do?• Ben Bromhead
• Co-founder and CTO of Instaclustr -> www.instaclustr.com
<sales>
• Instaclustr provides Cassandra-as-a-Service in the cloud.
• Currently in AWS, Azure and IBM with more to come.
• 100’s of TB under management.
</sales>
Objectives
• How to setup a local Cassandra environment
• Running multiple versions of Cassandra locally
• Integrating Cassandra into your test environment
• Dev tools for working with and understanding Cassandra
The Challenge
How do we work with Cassandra on daily basis so that?
• Cassandra doesn’t get in the way
• Provides us with a simple, fast, logical workflow
• As close as possible to production (without being painful to use)
• Understand what is going on under the hood
The Challenge
Different stages, different workflows
At each stage of a developers workflow, you have varying levels of interaction:
• Writing code - does it compile/work ?
• Running tests - does it work properly ?
At each stage I have the information I need to make it work if it doesn’t
Stage 0 - Writing codeSetup Cassandra locally to support a code, compile, run workflow.
• Let’s start from basics
• Download and run the using tarball
• Works out of the box in linux, os x and windows (use ps scripts)
• run using -f for easy stoping and starting
Stage 0 - Writing code
Tarball demo
Stage 0 - Writing codeSetup Cassandra locally to support a code, compile, run workflow.
• Let’s start from basics
• Is there a simpler way?
• What if I want to run multiple clusters, multiple nodes, multiple datacenter etc
Stage 0 - Writing code
Multiple nodes with Tarball demo
Stage 0 - Writing code
Multiple nodes with Tarball demo
Ok that was way too hard…
Stage 0 - Writing codeSetup Cassandra locally to support a code, compile, run workflow.
• Let’s start from basics
• Is there a simpler way?
• What if I want to run multiple clusters, multiple nodes, multiple datacenter etc?
• Enter Cassandra Cluster Manager (CCM)
Stage 0 - Writing codeCCM is a project written in Python that makes working with local Cassandra clusters easier.
• CCM a set of scripts to create, manage and destroy local Cassandra clusters
• ccmlib a python library to programmatically create, manage and destroy local Cassandra clusters.
Stage 0 - Writing codeWith CCM we now have an easy way to manage the whole tarball process we went through.
• CCM has many different options and capabilities and probably warrants its own webinar.
• Supports multiple datacenters (e.g. ccm create -n 3:3)
• Supports DSE + OpsCenter
• Used in the Datastax driver test suite and Cassandra test suite, so constantly updated!
Stage 1 - Testing codeHow do we integrate Cassandra into our test frameworks and automate it?
• Embedded Cassandra
• Use https://github.com/jsevellec/cassandra-unit
• Provides a nice wrapper around using an embedded Cassandra service
• Fits into the junit ecosystem
• Portable
Stage 1 - Testing demo
Cassandra-unit
Stage 1 - Testing codeHow do we integrate Cassandra into our test frameworks and automate it?
• Manually
• Embedded Cassandra
• CCM
Stage 1 - Testing codeHow do we integrate Cassandra into our test frameworks and automate it?
• Manually
• Requires calling truncate, drop keyspace etc at the start of your tests via CQL
• Have to write custom scripts to integrate with CI / build tools
• Let’s skip this…
Stage 1 - Testing codeHow do we integrate Cassandra into our test frameworks and automate it?
• CCM
• Used for Cassandra tests
• Also within Datastax cassandra drivers
• Java/Ruby/NodeJS bridges exist!
Stage 1 - CCM testing demo
Java-driver demo
Stage 1.5 - CI
How do we integrate Cassandra into our test frameworks and automate it?
• CCM and Cassandra-unit are best for this
• Cassandra-unit requires no additional config
• CCM requires python and ccm installed
DevTools
The basics will take you a long way:
• Datastax DevCenter (it’s free)!
• cqlsh
• cassandra-cli
DevCenter Demo
Cassandra-unit
CQLSH -> cassandra-cli
Demo
Thank you! Questions?
Bonus Material
• https://github.com/bcantoni/vagrant-cassandra
• http://christopher-batey.blogspot.com/2014/12/getting-started-cassandra-spark-with.html
• https://github.com/tobert/cassandra-docker