solr集群zookeeper---solrcould Could not connect to ZooKeeper
solr集群zookeeper之后,在eclipse端用solrj测试报如下错误,请教各位是什么问题?
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.
Exception in thread "main" org.apache.solr.common.SolrException: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper 192.168.1.122:2181 within 1000 ms
at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:181)
at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:115)
at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:105)
at org.apache.solr.common.cloud.ZkStateReader.<init>(ZkStateReader.java:238)
at org.apache.solr.client.solrj.impl.CloudSolrClient.connect(CloudSolrClient.java:459)
at com.qhii.controller.TestSolrCould.main(TestSolrCould.java:119)
Caused by: java.util.concurrent.TimeoutException: Could not connect to ZooKeeper 192.168.1.122:2181 within 1000 ms
at org.apache.solr.common.cloud.ConnectionManager.waitForConnected(ConnectionManager.java:208)
at org.apache.solr.common.cloud.SolrZkClient.<init>(SolrZkClient.java:173)
... 5 more
而用如下这种测试方式就没问题,返回了正确数据
address = "http://192.168.1.122:81/solr/solr";
httpServer = new HttpSolrServer(address);
SolrQuery solrQuery = new SolrQuery(query);
try {
QueryResponse response = httpServer.query(solrQuery);
System.out.println(response.getQTime());
} catch (SolrServerException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}