Cassandra cluster on local machine with CCM
source link: https://blog.knoldus.com/cassandra-cluster-on-local-machine-with-ccm/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cassandra cluster on local machine with CCM
Reading Time: 2 minutes
CCM (Cassandra Cluster Manager) is the tool for creating a cassandra cluster on local machine without any difficulty, But CCM is only use for the test cluster for local machine it will not use for production purpose.
So we start with install the CCM on our local machine with following instruction.
$ git clone https://github.com/pcmanus/ccm.git $ cd ccm && ./setup.py install
Now its time to jump into the CCM, So first we create a cluster with the CCM.
$ ccm create test -v 2.1.8
In above command with the help of -v flag we define cassandra version here its 2.1.8
Now we will define number of node for the above test cluster as below
$ ccm populate -n 4 $ ccm status
Here -n is use for number of node here its 4.
After populating ccm cluster when you see status of the cluster you will see all nodes are down so we should up it with the following command, below command will start cluster and up all the nodes in the cluster.
$ ccm start
With the help of CCM we can also run any command over the specific node as below
$ ccm <NODE_NAME> <COMMAND>
for example
$ccm node1 showlog
Above command show all the logs of node1 in test cluster.We can also see the token distribution on cluster with ring command
$ccm node1 ring
We can simply add and delete node from the cluster as follows
$ccm node1 remove $ccm add node5 -i 127.0.0.5
CCM have lot of command for cluster and node specific command so get all list of
command simply run
$ccm --help
At last we simply run cassandra shell (cqlsh) on cluster as below
$ccm node2 cqlsh
After you will open cqlsh on cluster you will see the log that connect to test cluster at 127.0.0.2:9042.
So now all cqlsh command will be run on cassandra cluster. So explore CCM command more and play with your cluster.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK