Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting up cassandra multi node cluster on a single ubuntu server

I have a Cassandra Service running on my Ubuntu Server with a single node now. I want to make it into a ring cluster with 3 nodes to get a feel of multinode cluster all being on the same server. By following the steps in this link https://www.youtube.com/watch?v=oHMJrhMtv3c, I tried to create a fresh cluster without stopping the already running cassandra service. But it has thrown address Caused by: java.net.BindException: Address already in use. So i tried changing the seeds ip to already running cassandra ip address and tried to run a second cassandra service in the foreground. This time it has thrown java.lang.RuntimeException: Unable to create thrift socket to ip port. Please let me know how to add nodes to a already running single node cluster on the same server.

like image 413
ktumu Avatar asked Mar 19 '14 17:03

ktumu


People also ask

How many nodes does Cassandra cluster have?

As we said earlier, each instance of Cassandra has evolved to contain 256 virtual nodes. The Cassandra server runs core processes. For example, processes like spreading replicas around nodes or routing requests.

How many Cassandra nodes minimum you should have in your cluster to make sure it is highly available?

In most cases, you'll want to operate with strong consistency and so need at least 3 nodes. This allows your Cassandra service to continue uninterrupted if you suffer a hardware failure or some other loss of the Cassandra service on a single node (this will happen sooner or later).

How do I set up a multi-node cluster in Cassandra?

Only the following directives need to be modified to set up a multi-node Cassandra cluster: cluster_name: This is the name of your cluster. -seeds: This is a comma-delimited list of the IP address of each node in the cluster. listen_address: This is IP address that other nodes in the cluster will use to connect to this one.

How many Ubuntu servers do I need for a Cassandra cluster?

Because you’re about to build a multi-node Cassandra cluster, you must determine how many servers you’d like to have in your cluster and configure each of them. It is recommended, but not required, that they have the same or similar specifications. At least two Ubuntu 14.04 servers configured using this initial setup guide.

What is Apache Cassandra in Ubuntu?

Apache Cassandra is a highly scalable open source database system, achieving great performance on multi-node setups. Previously, we went over how to run a single-node Cassandra cluster. In this tutorial, you’ll learn how to install and use Cassandra to run a multi-node cluster on Ubuntu 14.04.

What is Cassandra and how do I install it?

Developer and author at DigitalOcean. Cassandra, or Apache Cassandra, is a highly scalable open source NoSQL database system, achieving great performance on multi-node setups. In this tutorial, you’ll learn how to install and use it to run a single-node cluster on Ubuntu 14.04.


2 Answers

It is very easy to run multiple Cassandra instances on the same Ubuntu machine as long as they have different IP addresses that all resolve to the local host. The entire 127.0.0.0/8 address block is reserved for loopback purposes so any packet sent to addresses (127.0.0.1 through 127.255.255.254) will be looped back.

  • Use ping to check if the addresses resolve properly.
  • Place two (or more) Cassandra instances into different folders.

Edit cassandra.yaml and replace

  • Various file locations to the locations unique to the given instance of Cassandra.
  • localhost to the IP address we give to that instance (like 127.0.0.2).
  • Use SimpleSeedProvider and put addresses of all other Cassandra instances to the seed list to make a cluster (like - seeds: "127.0.0.2","127.0.0.3"
  • Do not alter any port numbers, not helpful and not required.

Edit cassandra-env.sh, find where the JMX_PORT property is set and give it a different value (different port) for every instance of Cassandra. Otherwise instances cannot run together because of the conflicts on this port.

  • start the instances one by one using ./cassandra startup script (you can write simple bash script for this later).
  • Verify your topology with ./nodetool status . For the two nodes, for instance, the output must look like

    Datacenter: datacenter1
    =======================
    Status=Up/Down
    |/ State=Normal/Leaving/Joining/Moving
    --  Address    Load       Tokens  Owns (effective)  Host ID                               Rack
    UN  127.0.0.1  61.97 KB   256     100.0%            6c04e202-8f24-4f17-b430-0154c1512316  rack1
    UN  127.0.0.2  105.68 KB  256     100.0%            ca3073ee-451c-4cef-97ee-d312784648bb  rack1
    
like image 178
Audrius Meškauskas Avatar answered Sep 19 '22 09:09

Audrius Meškauskas


The easiest way to set up a multinode cluster on a single machine is using CCM. Currently you are running into issues with your nodes attempting all bind the same set of ports. CCM will work around this for you and auto increment ports ect...

https://github.com/pcmanus/ccm

like image 32
RussS Avatar answered Sep 20 '22 09:09

RussS