Servicios de desarrollo para Elasticsearch
Si cualquier extensión relacionada con Elasticsearch está presente (por ejemplo, quarkus-elasticsearch-rest-client
o quarkus-hibernate-search-orm-elasticsearch
), Dev Services for Elasticsearch inicia automáticamente un servidor de Elasticsearch en modo dev y cuando se ejecutan pruebas. Por lo tanto, no tienes que iniciar un servidor manualmente. La aplicación se configura automáticamente.
Activación/desactivación de los servicios de desarrollo para Elasticsearch
Los servicios de desarrollo para Elasticsearch se activan automáticamente a menos que:
-
quarkus.devservices.enabled
se fija enfalse
. -
quarkus.elasticsearch.devservices.enabled
se ajusta afalse
-
the hosts property is configured, depending on the extension used it can be:
-
quarkus.elasticsearch.hosts
-
quarkus.hibernate-search-orm.elasticsearch.hosts
Dev Services for Elasticsearch se basa en Docker para iniciar el servidor. Si su entorno no admite Docker, tendrá que iniciar el servidor manualmente o conectarse a un servidor ya en funcionamiento.
Elasticsearch compartido
A veces es necesario compartir el servidor entre aplicaciones. Dev Services for Elasticsearch implementa un mecanismo de descubrimiento de servicios para que sus múltiples aplicaciones Quarkus que se ejecutan en modo dev compartan un único servidor.
Dev Services for Elasticsearch inicia el contenedor con la etiqueta quarkus-dev-service-elasticsearch que se utiliza para identificar el contenedor.
|
Si necesitas varios servidores (compartidos), puedes configurar el atributo quarkus.elasticsearch.devservices.service-name
e indicar el nombre del servidor. Se busca un contenedor con el mismo valor, o se inicia uno nuevo si no se encuentra ninguno. El nombre de servicio por defecto es elasticsearch
.
El uso compartido está activado por defecto en el modo de desarrollo, pero está desactivada en el modo de prueba. Puede desactivar el uso compartido con quarkus.elasticsearch.devservices.shared=false
.
Ajuste del puerto
Por defecto, Dev Services for Elasticsearch elige un puerto aleatorio y configura la aplicación. Puedes establecer el puerto configurando la propiedad quarkus.elasticsearch.devservices.port
.
Tenga en cuenta que la propiedad de hosts de Elasticsearch se configura automáticamente con el puerto elegido.
Configuración de la imagen
Dev Services for Elasticsearch only support Elasticsearch based images, OpenSearch is not supported at the moment.
If you need to use a different image than the default one you can configure it via:
quarkus.elasticsearch.devservices.image-name={elasticsearch-image}
Limitaciones actuales
Actualmente, sólo se admite el backend predeterminado para Hibernate Search Elasticsearch, porque Dev Services for Elasticsearch sólo puede iniciar un contenedor de Elasticsearch.
Referencia de configuración
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Type |
Default |
|
---|---|---|
If Dev Services for Elasticsearch has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For Elasticsearch, Dev Services starts a server unless Environment variable: |
boolean |
|
Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly. Environment variable: |
int |
|
The Elasticsearch container image to use. Defaults to the elasticsearch image provided by Elastic. Environment variable: |
string |
|
The value for the ES_JAVA_OPTS env variable. Defaults to setting the heap to 512MB min - 1GB max. Environment variable: |
string |
|
Indicates if the Elasticsearch server managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for Elasticsearch starts a new container.
The discovery uses the Environment variable: |
boolean |
|
The value of the Environment variable: |
string |
|