Clojure interface to Cassandra Cluster Manager allowing for arbitrary test clusters and easy integration testing.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Join the chat at

A Clojure (1.6+) interface to Cassandra Cluster Manager ( suitable for use in integration tests and creating arbitrary Cassandra Clusters. CCM-clj is courtesy of SMX ( where we have been using it for a couple of years to simplify development with Cassandra and Clojure. As a JVM library, it is however easily used with other languages [].

Current Version

Note: breaking change with 1.0. The ns moved from ccm-clj to ccm-clj.core for better Java integration (no longer using empty package).

Artifacts are released to Clojars. If you are using Maven, add the following repository definition to your pom.xml:


With Leiningen:

[com.smxemail/ccm-clj "1.1.0"]

With Maven:


CCM installation


brew install ccm

Otherwise see Requirements and Installation at x`

Note that local loopback aliasing may be required on OSX. I have /Library/LaunchDaemons/moreloopbacks.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

And then /usr/local/scripts/

for ((i=2;i<6;i++))
  sudo ifconfig lo0 alias 127.0.0.$i up


One line test cluster setup with auto-cluster!, args: name, version, number-of-nodes, map-of-keyspace-to-cql-re-paths

(ccm/auto-cluster! "test-cluster" "2.0.14" 3 ["schema/test-keyspace.cql"
                      {"my-keyspace" [#"schema/test.*schema.cql" #"schema/test.*data.cql"]})

Or for full fine-grained control:

(ns some-cassandra-test
  (:require [ccm-clj :as ccm]
            [ :as io]))

(if (not (ccm/cluster? "testcluster"))
    (ccm/new! "testcluster" cass-version num-nodes cql-port)
    (ccm/cql! (io/file "./test/resources/test-keyspace.cql"))
    (ccm/cql! (io/resource "schema/test-schema.cql") "testkeyspace")
    (ccm/cql! (io/file "./test/resources/test-data1.cql") "testkeyspace")
    (ccm/cql! (io/file "./test/resources/test-data2.cql") "testkeyspace"))
    (ccm/start! "testcluster")))
(ccm/remove! "testcluster")

Savepoints (New to 1.0):

(cql! "insert into testtable (id, data) values (99, 'tosurvive');")
(savepoint! "testsavepoint"))
(cql! "insert into testtable (id, data) values (100, 'torollback');")
(restore! "testsavepoint"))


  • This is NOT a CQL library it's for test cluster setup. Instead, use Alia or Cassaforte.
  • Similarly I don't intend to shadow every CCM function only to provide a useful integration API.
  • I test new releases on the current CCM, so you should upgrade CCM-clj and CCM at the same time.
  • Probably doesn't work on Windows. Patches welcome.
  • IPs from to 127.0.0.n will be used, this may require loopback aliasing see Installation.
  • Ports from cql-port to cql-port+3 will be assigned to CQL, thrift, JMX and storage respectively.
  • If you abort without cleanup, you may leave CassandraDaemon(s) running which you can stop from the repl (ccm/stop!) or in the shell ccm stop.
  • Using older versions of Cassandra may require Snappy-Java to be an explicit dependency due to
  • Error: Could not find or load main class org.apache.cassandra.service.CassandraDaemon might mean an interrupted download, try blowing away .ccm.

For more see the API in src/ccm_clj.clj or tests in test/ccm_clj_test.clj.

Tests Usage

lein all expectations


Colin Taylor at gmail.


Copyright © 2015 SMX Ltd ( and Contributors.

Distributed under the Eclipse Public License.