windows 7 - HUnavailableException:May not be enough replicas present to handle consistency level -


i using cassandra 1.2.4 on machine (windows 7).

i have got 3 nodes in dc1, on machine. using 1 dc (my machine). did keep replication factor=2 , "hconsistencylevel.one". however, when 1 of nodes down, , attempt read or write db, error - "may not enough replicas present handle consistency level.". under impression when keep consistency level "one" , if 1 node up, write/read should happen without errors. error. correct me doing wrong here. did search in google didn't error although error quite relevant. want make read/write happen in event of node failure. below 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<string, hconsistencylevel> clmap = new hashmap<string, hconsistencylevel>();  // define cl.one 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<string, string> cft = new thriftcolumnfamilytemplate<string,   string>(keyspace, columfamilyname, ss, ss); columnfamilyupdater<string, string> 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); 

change replication factor 1, i.e. number of nodes had setup. did same error exercising examples.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -