testcontainers / testcontainers/testcontainers-java
Solr container doesn't work with cloud (cluster) Solr client
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 1.9k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 9
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con examples/solr-container/src/test/java/com/example/SolrQueryTest.java, especialmente con la configuración de CloudSolrClient descrita en la línea 33. Sigue cómo el contenedor de Solr informa de su puerto de clúster en comparación con el puerto de host asignado. Se considera terminado cuando las solicitudes de CloudSolrClient funcionan a través del contenedor y las pruebas de SolrQueryTest pasan.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, java
- Área
- databases, testing
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100