How to Create a Cassandra Cluster on a Single Host (Debian)

From Linux Delta
Jump to: navigation, search

Cassandra is a scalable, high performance and partition tolerant distributed database. This guide will show you how to create multiple Cassandra nodes on a single host using Cassandra Cluster Manager (CCM).

Installing Cassandra Cluster Manager[edit]

sudo apt install -y python-pip python-setuptools python-wheel git openjdk-8-jre-headless openjdk-8-jdk bc
sudo pip install cql PyYAML
git clone https://github.com/riptano/ccm
cd ccm; sudo ./setup.py install; cd ..

Creating a Cluster[edit]

Create (and start) a standalone cluster bound to local host, running Cassandra version 2.1.21 with 3 Cassandra nodes:

ccm create test --version=2.1.21 --start --nodes 3

Create (and start) a standalone cluster, bound to local host, using a given ip range and RandomPartitioner:

ccm create test --version=2.1.21 --start --nodes 3 --ipprefix=192.168.13.157 --partitioner=org.apache.cassandra.dht.RandomPartitioner

Now your Cassandra cluster is good to go. You can connect to your cluster using cqlsh. For example:

cqlsh 192.168.13.157