Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

ranjeet_ranjee avatar image
ranjeet_ranjee asked ·

Why am I getting "Not enough replicas available for query at consistency ALL (4 required but only 2 alive)"?

Hi Guys,

I am facing an issue although I have only 2 node in my cluster.

com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /10.130.1.204:9042 (com.datastax.driver.core.exceptions.UnavailableException: Not enough replicas available for query at consistency ALL (4 required but only 2 alive))) 

Cassandra.yml

seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
  parameters:
  - seeds: "10.130.1.204,Public-IP-1,Public-IP-2,10.130.85.25"

Here you go cluster status

[root@cassandra-7 ~]# dsetool status
Warning: Not able to read Analytics Master data, SparkMaster data may not be correct.

DC: singaporedo     Workload: Cassandra       Graph: no     
======================================================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--   Address          Load             Owns                 Token                                        Rack         Health [0,1] 
                                                            1051212759506365289                                                    
UN   IP-1   379.53 GiB       ?                    -921962553594005710                          rack-1       0.90         
UN   IP-2    407.37 GiB       ?                    1051212759506365289                          rack-1       0.90         
cassandra
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

dmngaya avatar image
dmngaya answered ·

It will be fine but from your application what kind of Consistency level are you using ? if it is quorum but use LOCAL_QUORUM. Also if you remove datacenter singaporedo , you will reduce also number of seeds. i saw 3 nodes seeds in you cassandra.yaml.

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

bhisey.swapnil avatar image
bhisey.swapnil answered ·

Hi Ranjeet,


Looks like you have set Replication factor of four on keyspace even though you just have two nodes.

Neither reads nor writes will work with more than consistency level of one or two as the 3rd and 4th node to hold data does not exist. In fact, the error message is given a helpful clue that 4 replicas were needed but the only two were available. You can read more about replication factor in Datastax documentation.

https://docs.datastax.com/en/dse/6.8/dse-arch/datastax_enterprise/dbArch/archDataDistributeReplication.html


Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.