scala - Why does Spark Cassandra Connector fail with NoHostAvailableException? -
i having problems getting spark cassandra connector working in scala.
i'm using these versions:
- scala 2.10.4
- spark-core 1.0.2
- cassandra-thrift 2.1.0 (my installed cassandra v2.1.0)
- cassandra-clientutil 2.1.0
- cassandra-driver-core 2.0.4 (recommended connector?)
- spark-cassandra-connector 1.0.0
i can connect , talk cassandra (w/o spark) , can talk spark (w/o cassandra) connector gives me:
com.datastax.driver.core.exceptions.nohostavailableexception: host(s) tried query failed (tried: /10.0.0.194:9042 (com.datastax.driver.core.transportexception: [/10.0.0.194:9042] cannot connect))
what missing? cassandra default install (port 9042 cql according cassandra.yaml). i'm trying connect locally ("local").
my code:
val conf = new sparkconf().setappname("simple application").setmaster("local") val sc = new sparkcontext("local","test",conf) val rdd = sc.cassandratable("myks","users") val rr = rdd.first println(s"result: $rr")
local in context specifying spark master (telling run in local mode) , not cassandra connection host.
to set cassandra connection host have set different property in spark config
import org.apache.spark._ val conf = new sparkconf(true) .set("spark.cassandra.connection.host", "ip cassandra listening on") .set("spark.cassandra.username", "cassandra") //optional .set("spark.cassandra.password", "cassandra") //optional val sc = new sparkcontext("spark://spark master ip:7077", "test", conf)
https://github.com/datastax/spark-cassandra-connector/blob/master/doc/1_connecting.md
Comments
Post a Comment