Note that there are some explanatory texts on larger screens.

plurals
  1. POHUnavailableException:May not be enough replicas present to handle consistency level
    primarykey
    data
    text
    <p>I am using Cassandra 1.2.4 on my machine (windows 7).</p> <p>I have got 3 nodes in my DC1, which is on my machine. I am only using one DC (my machine). I did keep replication factor=2 and "HConsistencyLevel.ONE". However, when one of the nodes is down, and I attempt to read or write to DB, I get the error - "May not be enough replicas present to handle consistency level.". I am under the impression that when we keep the consistency level as "ONE" and even if one node is up, the write/read should happen without errors. But I get this error. Could someone correct me as what I was doing wrong here. I did search in google but didn't get much help about this error although this error is quite relevant. I want to make the read/write happen in the event of node failure. Below is my code.</p> <pre><code>String keySpaceName="kspace"; String clusterName="Test Cluster"; String columFamilyName="ktable"; String host="127.0.0.1:9160,127.0.0.2:9161,127.0.0.3:9162"; int replicationFactor=2; CassandraHostConfigurator cassandraHostConfigurator = new CassandraHostConfigurator(host); Cluster cluster = HFactory.getOrCreateCluster(clusterName,cassandraHostConfigurator); KeyspaceDefinition keyspaceDef = cluster.describeKeyspace(keySpaceName); ConfigurableConsistencyLevel configurableConsistencyLevel = new ConfigurableConsistencyLevel(); Map&lt;String, HConsistencyLevel&gt; clmap = new HashMap&lt;String, HConsistencyLevel&gt;(); // Define CL.ONE for ColumnFamily "ktable" clmap.put(columFamilyName, HConsistencyLevel.ONE); configurableConsistencyLevel.setReadCfConsistencyLevels(clmap); configurableConsistencyLevel.setWriteCfConsistencyLevels(clmap); if(keyspaceDef==null) { KeyspaceDefinition newKeyspace = HFactory.createKeyspaceDefinition( keySpaceName, ThriftKsDef.DEF_STRATEGY_CLASS,replicationFactor, null); cluster.addKeyspace(newKeyspace, true); } Keyspace keyspace = HFactory.createKeyspace(keySpaceName, cluster, configurableConsistencyLevel); StringSerializer ss = StringSerializer.get(); ColumnFamilyTemplate&lt;String, String&gt; cft = new ThriftColumnFamilyTemplate&lt;String, String&gt;(keyspace, columFamilyName, ss, ss); ColumnFamilyUpdater&lt;String, String&gt; updater = cft.createUpdater("xkey"); UUID uid = new UUID(); updater.setValue("id",Long.toString(uid.getClockSeqAndNode()),ss); updater.setValue("name", "Catherine", ss); updater.setValue("state", "GA", ss); cft.update(updater); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload