The Cassandra Cluster Manager is a command line tool authored by Apache Cassandra™ committer and PMC member Sylvain Lebresne that sets up Cassandra clusters on localhost. I am currently a maintainer for CCM, adding features and fixing bugs as part of my job as a Test Engineer for Apache Cassandra. For an overview of CCM, please see this blog post by Tyler Hobbs. In this post, I'd like to bring you up to speed on the latest CCM improvements, particularly how you can now run a local DataStax Enterprise cluster from the comfort of your command prompt!
In late October, CCM 2.0 was released, adding support for DataStax Enterprise. It also added support for running on Windows with Cassandra 2.1. CCM is a python package which can be installed from PyPI with
pip install ccm, or installed from source. For setup, installation, and usage instructions, see the README.
Using Apache Cassandra with CCM
CCM lets you create Apache Cassandra clusters on localhost as a development tool. Setting up a three node cluster of the latest version is as easy as:
ccm create test_cluster -v 2.1.2
ccm populate -n 3
which can be simplified to
ccm create test_cluster -v 2.1.2 -n 3 -s.
From here you can run
ccm status to confirm you have three Cassandra instances running on localhost. You can access your cluster with any DataStax driver, cqlsh, or nodetool. A cluster created with CCM provides all of the functionality of a real Apache Cassandra cluster. CCM also provides a convenient python API to use instead of the command line interface.
Downloading DataStax Enterprise
Downloading DSE via CCM requires a username and password, which you can get from https://www.datastax.com/download. When creating a dse cluster with an undownloaded version, you will need to include your username and password on the command line:
From then on, anytime you create a cluster using that version, you will not need to include your username and password. The downloaded version is stored alongside cassandra in ~/.ccm/repository/$VERSION
CCM is an excellent way to interact with DataStax Enterprise. You can set up an Analytics datacenter, a Cassandra datacenter, and a Solr datacenter, all on your laptop!
To use Datastax Enterprise instead of Apache Cassandra with CCM, clusters must be created with the --dse command line option,
ccm create dse_cluster --dse -v 4.5.2 -n 3 -s. This will give you a fully featured DataStax Enterprise cluster with Solr and Hadoop integration. To set a node’s workload, use
ccm node1 setworkload [cassandra|solr|hadoop|spark].
A number of new node commands have been added to interact with nodes in DSE clusters. These commands allow you to use the DSE features that are unavailable when using Apache Cassandra.
ccm node1 [hive|spark|hadoop|pig|sqoop]
All of the normal CCM commands can be run against DSE clusters. Here is a code example on how to set up a three datacenter cluster with Cassandra, Solr, and Analytics:
ccm create dse_cluster --dse -v 4.5.2 -n 1:1:1
ccm node2 setworkload solr
ccm node3 setworkload spark
CCM 2.0 provides an easy way for you to test and interact with a fully featured DataStax Enterprise cluster. When using DataStax Enterprise, please respect the terms of the license. Remember, CCM is explicitly not intended for production use or performance testing. If you have any issues, please report them on github. Pull Requests are appreciated!