Reputation: 11
When hitting the solr-cloud(exposed ports are 8983) from java code using zookeeperURI(exposed port 2181) which are started using docker-compose and error is thrown saying that "org.apache.solr.client.solrj.SolrServerException: No live SolrServers available to handle this request:[http://172.21.0.4:8983/solr/test]".
Is there a way to resolve this?
Upvotes: 1
Views: 642
Reputation: 704
Using the parameter -u your-hostname
when starting Solr finally worked for me. By doing that, I have zookeeper return your-hostname
instead of the IP. You can then add:
127.0.0.1 your-hostname
to your /etc/hosts
and that should do the magic. As I say, it worked for me.
My docker-compose.xml
is as easy as:
version: '2'
services:
...
oesp-zookeeper:
image: zookeeper:1
container_name: my-zookeeper
ports:
- 2181:2181
oesp-solr:
image: solr:1
container_name: my-solr
depends_on:
- my-zookeeper
ports:
- 8983:8983
Then I start Solr with:
solr -f -z my-zookeeper:2181 -h solr.docker
Upvotes: 1
Reputation: 30157
The ip address returned to SolrJ (172.21.0.4
) is the Ip of the SolrCloud container which is not reachable externally.
To solve to this problem I suggest to specify a hostname for the Solr instance instead of default ip address. Which means that you have to define the SOLR_HOST: solr-cloud
environment variable in your docker-compose.yml
.
Have a look at this https://github.com/freedev/solrcloud-zookeeper-docker
In particular the file solrcloud/docker-compose.yml
is configured as I have described in former lines of my answer.
Upvotes: 0