Will not attempt to authenticate using SASL (unknown error)
09:20 12 Mar 2019

I try to query data from Solr through Spark. I have a problem with ZooKeeper connection. I have started solr as follows: solr start (not solr cloud) and also zkserver on another cmd.

Please have a look at my code:

object solr extends App {

  val zkHost = "127.0.0.1:57864"
  val collection = "website"
  val queryStr = "*:*"

  val conf = new SparkConf().setMaster("local").setAppName("My App")
  val sc = new SparkContext(conf)

  val solrRDD: SelectSolrRDD = new SelectSolrRDD(zkHost, collection, sc)
  val rdd: RDD[SolrDocument]  = solrRDD.query(queryStr)

  val words: RDD[String] = rdd.map(doc => if (doc.containsKey("the")) doc.get("the").toString else "")

  val counts = words
    .map(word => (word, 1))
    .reduceByKey(_ + _)

  counts.foreach(println)
  System.out.println("Total words: " + counts.count());

  sc.stop()
}

I also tried with val zkHost = "localhost:2181" but I become the same error.

My error looks like:

19/03/12 15:59:09 INFO ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:57864. Will not attempt to authenticate using SASL (unknown error)
19/03/12 15:59:10 INFO ClientCnxn: Socket error occurred: 127.0.0.1/127.0.0.1:57864: Connection refused: no further information
19/03/12 15:59:11 INFO ClientCnxn: Opening socket connection to server 127.0.0.1/127.0.0.1:57864. Will not attempt to authenticate using SASL (unknown error)
19/03/12 15:59:12 INFO ClientCnxn: Socket error occurred: 127.0.0.1/127.0.0.1:57864: Connection refused: no further information

... and this continously. And at the end:

Exception in thread "main" com.google.common.util.concurrent.UncheckedExecutionException: org.apache.solr.common.SolrException: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper 127.0.0.1:57864 within 60000 ms

Does anyone know what do I miss?

scala apache-spark solr