Skip to content

Solr container doesn't work with cloud (cluster) Solr client #4389

Open
@acsbendi

Description

@acsbendi

It is not possible to use the Solr container with the cloud Solr client (CloudSolrClient, this client can be used for accessing Solr clusters), because the following exception is thrown when trying to send any request:

Tried fetching cluster state using the node names we knew of, i.e. [localhost:8983_solr]. However, succeeded in obtaining the cluster state from none of them.If you think your Solr cluster is up and is accessible, you could try re-creating a new CloudSolrClient using working solrUrl(s) or zkHost(s).
java.lang.RuntimeException: Tried fetching cluster state using the node names we knew of, i.e. [localhost:8983_solr]. However, succeeded in obtaining the cluster state from none of them.If you think your Solr cluster is up and is accessible, you could try re-creating a new CloudSolrClient using working solrUrl(s) or zkHost(s).
	at org.apache.solr.client.solrj.impl.BaseHttpClusterStateProvider.getState(BaseHttpClusterStateProvider.java:105)
	at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.resolveAliases(BaseCloudSolrClient.java:1182)
	at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.requestWithRetryOnStaleState(BaseCloudSolrClient.java:894)
	at org.apache.solr.client.solrj.impl.BaseCloudSolrClient.request(BaseCloudSolrClient.java:866)
	at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:214)
	at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:106)
	at org.apache.solr.client.solrj.SolrClient.add(SolrClient.java:71)
	at com.example.SolrQueryTest.setUp(SolrQueryTest.java:37)
...

You can see this exception after changing this line to
solrClient = new CloudSolrClient.Builder(Collections.singletonList("http://" + solrContainer.getContainerIpAddress() + ":" + solrContainer.getSolrPort() + "/solr")).build(); and running any test in SolrQueryTest.java.

The underlying issue is that the cluster will report 8983 as the port used by Solr, but the container uses a different host port, so localhost:8983 will not be available to the client.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions