Cassandra requesting data from a node which is down?

1k Views Asked by At

Setup: 2 Nodes, Ec2Snitch
1 Node UP 54.1xx.1xx.1xx

1 Node Down 54.1xx.2xx.1xx [deliberately]

Keyspace NetworkTopology Replication Factor of 2 (both the nodes have data)

Now I tested read with Consistency level ONE.

Im getting "All host(s) tried for query failed. First host tried, 54.1xx.2xx.1xx: Host considered as DOWN. See innerErrors."
Getting this for the node that is down.

Why am i getting this exception? Shouldn't Cassandra service all requests from Node which is UP automatically? [I was expecting Cassandra to handle it.]

Or should we be dealing with a node which is DN (Down Normal) How do i deal with this?

If i manually make the Down node Up, I get all the responses else i get the above error for the first 1/4 of total requests.

1

There are 1 best solutions below

2
On

The default load balancing policy in the DataStax Node.js Driver for Cassandra is TokenAwarePolicy with DCAwareRoundRobinPolicy as child policy. The DCAwareRoundRobinPolicy is set to use 0 remote nodes by default.

You can change it to use 1 node of each remote datacenter, if the local nodes fail.

var localDc = "east1";
var remoteNodes = 1;
var options = { 
  policies: {loadBalancing: new DCAwareRoundRobinPolicy(localDc, remoteNodes)}
};
var client = new Client(options);