testcontainers / testcontainers/testcontainers-java
Solr container doesn't work with cloud (cluster) Solr client
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 9
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da examples/solr-container/src/test/java/com/example/SolrQueryTest.java, in particolare dalla configurazione di CloudSolrClient descritta alla riga 33. Traccia il modo in cui il container Solr segnala la porta del cluster rispetto alla porta host mappata. Il lavoro è completato quando le richieste CloudSolrClient funzionano attraverso il container e i test SolrQueryTest hanno esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, java
- Ambito
- databases, testing
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100