无法初始化HttpClusterStateProvider(是/是Solr服务器,[localhost:8983],向下?)

时间:2018-05-20 20:47:18

标签: solr

我是MacOS上Solr 7.3.0的新手。

我正在尝试构建Solr云服务器。

object CloudSolRServerBuilder {
  def build(zkHost: String): CloudSolrClient = {
    new CloudSolrClient.Builder(mutable.Buffer(zkHost)).build()
  }

我收到以下错误信息

Exception in thread "main" java.lang.RuntimeException: Couldn't initialize a HttpClusterStateProvider (is/are the Solr server(s), [localhost:8983], down?)
    at org.apache.solr.client.solrj.impl.CloudSolrClient$Builder.build(CloudSolrClient.java:1550)
    at org.PT.SparkDataPipeline.CloudSolRServerBuilder$.build(SolRSupport.scala:15)
    at org.PT.SparkDataPipeline.RunDataPipeline$.main(RunDataPipeline.scala:42)
    at org.PT.SparkDataPipeline.RunDataPipeline.main(RunDataPipeline.scala)
Caused by: org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: localhost:8983
    at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:657)
    at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:255)
    at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:244)
    at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1219)
    at org.apache.solr.client.solrj.impl.HttpClusterStateProvider.fetchLiveNodes(HttpClusterStateProvider.java:191)
    at org.apache.solr.client.solrj.impl.HttpClusterStateProvider.<init>(HttpClusterStateProvider.java:65)
    at org.apache.solr.client.solrj.impl.CloudSolrClient$Builder.build(CloudSolrClient.java:1548)
    ... 3 more
Caused by: org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: localhost:8983/admin/collections?action=CLUSTERSTATUS&wt=javabin&version=2
    at org.apache.http.impl.client.CloseableHttpClient.determineTarget(CloseableHttpClient.java:95)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
    at org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:542)
    ... 9 more

我查看了localhost:8983,我可以访问Solr Admin UI。

1 个答案:

答案 0 :(得分:0)

如果查看docs,您会看到传递给CloudSolrClient的字符串不正确,它应该是这样的:

String zkHostString = "zkServerA:2181";

(实际上,如果你有一个zk合奏,就像这样的字符串一样的列表)。