Question

I am trying to upgrade from Solr 4-Beta to Solr 4. While using Solr 4-beta, I configured the host and port number in Solr.xml file as below, and everything worked fine.

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

But when I upgraded to Solr 4.0, the ZooKeeper base URL is being set to "http://Computer-name:8983/Solr" which throws the below exception while contacting the other nodes. For some reason the ZooKeeper initialization is not picking the host and port information from the Solr.xml, but is getting the default Solr port and context information. Can someone please help on how to correct this ZooKeeper's 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 
Was it helpful?

Solution

Your solr.xml config looks okay. Except sharedLib="lib", sharedLib attribute belongs to tag <solr persistent="true" sharedLib="lib">.

Exception Caused by: java.net.UnknownHostException: COMPUTER-NAME

Please ensure following:

1) ZooKeeper hostname(s) provided in zkHost param are mapped in hosts file

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

Hosts file definition

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

2) Updated solr.xml present in correct path of SOLR_HOME

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top