1

我正在尝试从 Solr 4-Beta 升级到 Solr 4。在使用 Solr 4-beta 时,我在 Solr.xml 文件中配置了主机和端口号,如下所示,一切正常。

<solr persistent="true">
  <cores host="xxx.xx.x.xxx" adminPath="/admin/cores" hostPort="8180" hostContext="solr4" sharedLib="lib">
  </cores>
</solr>

但是当我升级到 Solr 4.0 时,ZooKeeper 基本 URL 被设置为“http://Computer-name:8983/Solr”,这在联系其他节点时会引发以下异常。由于某种原因,ZooKeeper 初始化没有从 Solr.xml 中选择主机和端口信息,而是获取默认的 Solr 端口和上下文信息。有人可以帮忙纠正这个 ZooKeeper 的 base_url 吗?

SEVERE: Error while trying to recover. core=collection1:org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: http://ComputerName:8983/solr
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:413)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
    at org.apache.solr.cloud.RecoveryStrategy.sendPrepRecoveryCmd(RecoveryStrategy.java:199)
    at org.apache.solr.cloud.RecoveryStrategy.doRecovery(RecoveryStrategy.java:388)
    at org.apache.solr.cloud.RecoveryStrategy.run(RecoveryStrategy.java:220)
Caused by: java.net.UnknownHostException: COMPUTER-NAME
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849)
    at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1202)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1153)
    at java.net.InetAddress.getAllByName(InetAddress.java:1083)
    at java.net.InetAddress.getAllByName(InetAddress.java:1019)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:150)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:575)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
    at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:352)
    ... 4 more 
4

1 回答 1

3

您的 solr.xml 配置看起来不错。除了sharedLib="lib"sharedLib 属性属于 tag <solr persistent="true" sharedLib="lib">

例外Caused by: java.net.UnknownHostException: COMPUTER-NAME

请确保以下几点:

1)zkHost参数中提供的 ZooKeeper 主机名映射到hosts文件中

-DzkHost=COMPUTER-NAME:2181,localhost:2182,localhost:2183

主机文件定义

127.0.0.1    localhost
xxx.xxx.xxx.xxx     COMPUTER-NAME

2)更新solr.xml存在于正确的路径SOLR_HOME

于 2012-11-28T08:43:58.520 回答