Being able to rapidly iterate on, build and test your code is key to being a productive developer. Without local automation, working with the numerous platforms and technologies in your stack can become very frustrating.
In this on-demand webinar, Ben Bromhead CTO of Instaclustr explores best practices to easily integrate Apache Cassandra into your development workflow, so you spend more time writing good code and less time fighting your environment.
2. 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>
3. 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
4. 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
6. 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
7. Stage 0 - Writing code
Setup 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
9. Stage 0 - Writing code
Setup 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
11. Stage 0 - Writing code
Multiple nodes with Tarball demo
Ok that was way too hard…
12. Stage 0 - Writing code
Setup 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)
13. Stage 0 - Writing code
CCM 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.
15. Stage 0 - Writing code
With 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!
16. Stage 1 - Testing code
How 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
18. Stage 1 - Testing code
How do we integrate Cassandra into our test frameworks and automate it?
• Manually
• Embedded Cassandra
• CCM
19. Stage 1 - Testing code
How 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…
20. Stage 1 - Testing code
How 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!
22. 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
23. DevTools
The basics will take you a long way:
• Datastax DevCenter (it’s free)!
• cqlsh
• cassandra-cli