java - Cassandra NoHostAvailableException caused by DriverException while traversing a resultset -


i getting error repeatedly while traversing resultset of size 100,000 . have used

.withreconnectionpolicy(new constantreconnectionpolicy(1000))                 .withretrypolicy(defaultretrypolicy.instance)                 .withqueryoptions(new queryoptions().setfetchsize(2000)) 

in connector. still getting error. typically fails after fetching 80000 rows.

com.datastax.driver.core.exceptions.nohostavailableexception: host(s) tried query failed (tried: /172.16.12.143:9042 (com.datastax.driver.core.exceptions.driverexception: timed out waiting server response), /172.16.12.141:9042 (com.datastax.driver.core.exceptions.driverexception: timed out waiting server response)) @ com.datastax.driver.core.exceptions.nohostavailableexception.copy(nohostavailableexception.java:65) @ com.datastax.driver.core.defaultresultsetfuture.extractcausefromexecutionexception(defaultresultsetfuture.java:259) @ com.datastax.driver.core.defaultresultsetfuture.getuninterruptibly(defaultresultsetfuture.java:175) @ com.datastax.driver.core.abstractsession.execute(abstractsession.java:52) @ com.payu.merchantanalytics.funnelhourlyutilcql.groupbyhourcql(funnelhourlyutilcql.java:87) @ com.payu.merchantanalytics.funnelhourlyutilcql.main(funnelhourlyutilcql.java:49) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ org.apache.spark.deploy.worker.driverwrapper$.main(driverwrapper.scala:58) @ org.apache.spark.deploy.worker.driverwrapper.main(driverwrapper.scala) caused by: com.datastax.driver.core.exceptions.nohostavailableexception: host(s) tried query failed (tried: /172.16.12.143:9042 (com.datastax.driver.core.exceptions.driverexception: timed out waiting server response), /172.16.12.141:9042 (com.datastax.driver.core.exceptions.driverexception: timed out waiting server response)) @ com.datastax.driver.core.requesthandler.sendrequest(requesthandler.java:108) @ com.datastax.driver.core.requesthandler$1.run(requesthandler.java:179) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745)


solved thanks andy tolbert answer. setting readtimeoutmillis using socketoptions.setreadtimeoutmillis(100000) worked.

now code looks :-

socketoptions socketoptions = new socketoptions().setreadtimeoutmillis(100000); cluster.builder()                 .addcontactpoints(nodes)                 .withreconnectionpolicy(new constantreconnectionpolicy(1000))                 .withretrypolicy(defaultretrypolicy.instance)                 .withqueryoptions(new queryoptions().setfetchsize(2000))                 .withsocketoptions(socketoptions)                 .withcredentials(username, password).build(); 

thanks lot :)


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -