Devaraj Kommineni
Devaraj Kommineni

Reputation: 121

how does cassandra reacts when a write is being performed in node and node went down

We have 2 node Cassandra cluster. Replication factor is 1 and consistency level is 1. We are not using replication as the data we are inserting is very huge for each record. How does Cassandra reacts when a node is down when write is being performed in that node? We are using Hector API from Java client. My understanding is that Cassandra will perform the write to other node which is running.

Upvotes: 1

Views: 217

Answers (1)

HashtagMarkus
HashtagMarkus

Reputation: 1661

No, using CL.ONE the write would not be performed if the inserted data belongs to the tokenrange of the downed node. The consistency level defines how many replica nodes have to respond to accept the request.

If you want to be able to write, even if the replica node is down, you need to use CL.ANY. ANY will make sure that the coordinator stores a hint for the request. Hints are stored in System.Hints table. After the replica comes back up again, all hints will be processed and sent to the upcoming node.

Edit

You will receive the following error:

com.datastax.driver.core.exceptions.UnavailableException: Not enough replica available for query at consistency ONE (1 required but only 0 alive)

Upvotes: 2

Related Questions