TechnologyJanuary 26, 2015

CCM 2.0 and Windows

Kishan Karunaratne
Kishan Karunaratne
CCM 2.0 and Windows
require 'cassandra'
cluster_status = `ccm status`
`ccm create test_cluster -v 2.1.2 -n 1 -s` unless cluster_status.include?("test_cluster")
raise "Node not UP" unless cluster_status.include?("UP")
cassandra_version = `ccm node1 version`
raise "Wrong Cassandra version" unless cassandra_version.include?("2.1.2")
cluster = Cassandra.cluster
session = cluster.connect()
session.execute("CREATE KEYSPACE IF NOT EXISTS simplex WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};")
session.execute("USE simplex")
session.execute("CREATE TABLE IF NOT EXISTS test (k text, v int, PRIMARY KEY (k, v));")
session.execute("INSERT INTO test (k, v) VALUES ('a', 1)")
result = session.execute("SELECT * FROM test").first
raise "Unsuccessful insert" unless result == {"k"=>"a", "v"=>1}
`ccm stop && ccm start`
cluster_status = `ccm node1 status`
raise "Node not ready" unless cluster_status.include?("UN")
`ccm remove`
Discover more
Apache Cassandra™

NoSQL and Vector DB
for Generative AI,
Instantly, At Scale

Vector search capabilities on Astra DB enable complex, context-sensitive searches across diverse data formats for use in Generative AI applications, powered by Apache Cassandra®.