In previous article we came across how to install and run a single node Cassandra cluster in Ubuntu. In this article we will come across how to setup a multi-node cluster on Ubuntu.
We will try to create a cluster using 5 different machines to make a ring of 5 nodes.
Now our 5 machines nodes have address as follows:
Apache Cassandra Multiple Node cluster
For production environments we strongly recommend to use a multi-node cluster, that is what Cassandra actually made for. In this article we will show how to install a multi node Cassandra cluster on Linux machine.
We will create two seed nodes among these 5 and will start them first so that they can seed to other nodes joining the cluster, steps are as follows:
Install Java 8+ on each and every now, we will have a cluster of Cassandra 3 and that requires Java 8+. Make sure you have a running Java on each node as follows:
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
If Java is not installed please follow this link to install Java first: Install Java on Ubuntu.
Download and extract Cassandra distribution package in any folder of your choice, as follows:
You should see somwthing like this, indicating that the file is being downloaded:
--2015-11-22 00:49:25-- http://www.eu.apache.org/dist/cassandra/3.0.0/apache-cassandra-3.0.0-bin.tar.gz
Resolving www.eu.apache.org (www.eu.apache.org)... 184.108.40.206, 2a01:4f8:130:2192::2
Connecting to www.eu.apache.org (www.eu.apache.org)|220.127.116.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 30706232 (29M) [application/x-gzip]
Saving to: "apache-cassandra-3.0.0-bin.tar.gz"
Unzip the downloaded file with following command:
tar -xvzf apache-cassandra-3.0.0
Configuration for seed nodes, listen_address and rpc_address on cassandra.yaml file
Open cassandra.yaml file in each node and change following entries:
seeds: "10.62.200.31, 10.62.200.32"
Make sure that, seeds and cluster_name will be same for each node and listen_address, rpc_address will be the ip of particular node.
Start the cluster and verify
First of all seed nodes should be started so that they can seed to other nodes coming to join the cluster:
sudo sh cassandra
Now start all the nodes using same command.
To verify the cluster go to any of the node and supply following command:
This should show following outup to display the cluster status:
-- Address Load Tokens Owns Host ID Rack
UN 10.62.200.31 142.04 KB 256 ? e97a6709-3216-43af-90de-5a3017761a46 rack1
UN 10.62.200.32 142.04 KB 256 ? e97a6709-3216-43af-90de-5a3017761a46 rack1
UN 10.62.200.33 127.83 KB 256 ? 6f74e3f8-4f20-43d8-90ff-5439939f5159 rack1
UN 10.62.200.34 137.89 KB 256 ? 8bd7390d-dde8-4aaa-8a44-73981e698a05 rack1
UN 10.62.200.35 161.07 KB 256 ? cf967b8c-4187-46d3-a464-fff09c28bb0d rack1
That's it, we are here done with creating a multiple mode Cassandra cluster with 5 nodes, out of them 2 are seed nodes.