testcontainers / testcontainers/testcontainers-java
Solr container doesn't work with cloud (cluster) Solr client
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 8.7k
- Forks
- 1.9k
- Ø Merge
- 2 T. 17 Std.
- Gemergte PRs (30 T.)
- 9
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit examples/solr-container/src/test/java/com/example/SolrQueryTest.java, insbesondere mit dem unter Zeile 33 beschriebenen CloudSolrClient-Setup. Verfolge, wie der Solr-Container seinen Cluster-Port im Vergleich zum zugeordneten Host-Port meldet. Erledigt ist die Aufgabe, wenn CloudSolrClient-Anfragen über den Container funktionieren und die SolrQueryTest-Tests bestehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- docker, java
- Bereich
- databases, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100