The English version of quarkus.io is the official project site. Translated sites are community supported on a best-effort basis.

Servicios de desarrollo para Redis

Quarkus supports a feature called Dev Services that allows you to create various datasources without any config. What that means practically, is that if you have docker running and have not configured quarkus.redis.hosts, Quarkus will automatically start a Redis container when running tests or dev mode, and automatically configure the connection.

Propiedades disponibles para personalizar el Redis DevService.

Configuration property fixed at build time - All other configuration properties are overridable at runtime

Configuration property

Type

Default

If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode and when Docker is running.

Environment variable: QUARKUS_REDIS_DEVSERVICES_ENABLED

boolean

true

The container image name to use, for container based DevServices providers. If you want to use Redis Stack modules (bloom, graph, search…​), use: redis/redis-stack-server:latest.

Environment variable: QUARKUS_REDIS_DEVSERVICES_IMAGE_NAME

string

Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_REDIS_DEVSERVICES_PORT

int

Indicates if the Redis 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 Redis starts a new container. The discovery uses the quarkus-dev-service-redis label. The value is configured using the service-name property. Container sharing is only used in dev mode.

Environment variable: QUARKUS_REDIS_DEVSERVICES_SHARED

boolean

true

The value of the quarkus-dev-service-redis label attached to the started container. This property is used when shared is set to true. In this case, before starting a container, Dev Services for Redis looks for a container with the quarkus-dev-service-redis label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the quarkus-dev-service-redis label set to the specified value. This property is used when you need multiple shared Redis servers.

Environment variable: QUARKUS_REDIS_DEVSERVICES_SERVICE_NAME

string

redis

If DevServices has been explicitly enabled or disabled. DevServices is generally enabled by default, unless there is an existing configuration present. When DevServices is enabled Quarkus will attempt to automatically configure and start a database when running in Dev or Test mode and when Docker is running.

Environment variable: QUARKUS_REDIS__ADDITIONAL_REDIS_CLIENTS__DEVSERVICES_ENABLED

boolean

true

The container image name to use, for container based DevServices providers. If you want to use Redis Stack modules (bloom, graph, search…​), use: redis/redis-stack-server:latest.

Environment variable: QUARKUS_REDIS__ADDITIONAL_REDIS_CLIENTS__DEVSERVICES_IMAGE_NAME

string

Optional fixed port the dev service will listen to. If not defined, the port will be chosen randomly.

Environment variable: QUARKUS_REDIS__ADDITIONAL_REDIS_CLIENTS__DEVSERVICES_PORT

int

Indicates if the Redis 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 Redis starts a new container. The discovery uses the quarkus-dev-service-redis label. The value is configured using the service-name property. Container sharing is only used in dev mode.

Environment variable: QUARKUS_REDIS__ADDITIONAL_REDIS_CLIENTS__DEVSERVICES_SHARED

boolean

true

The value of the quarkus-dev-service-redis label attached to the started container. This property is used when shared is set to true. In this case, before starting a container, Dev Services for Redis looks for a container with the quarkus-dev-service-redis label set to the configured value. If found, it will use this container instead of starting a new one. Otherwise, it starts a new container with the quarkus-dev-service-redis label set to the specified value. This property is used when you need multiple shared Redis servers.

Environment variable: QUARKUS_REDIS__ADDITIONAL_REDIS_CLIENTS__DEVSERVICES_SERVICE_NAME

string

redis

Cuando se ejecuta la versión de producción de la aplicación, la conexión de Redis debe configurarse de forma normal, por lo que si desea incluir una configuración de base de datos de producción en su application.properties y seguir utilizando los servicios de desarrollo, le recomendamos que utilice el perfil %prod. para definir su configuración de Redis.

Dev Services for Redis 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.

If you want to use Redis Stack modules (bloom, graph, search…​), set the image-name to redis/redis-stack:latest

Servidor compartido

La mayoría de las veces se necesita compartir el servidor entre aplicaciones. Dev Services for Redis implementa un mecanismo de descubrimiento de servicios para que tus múltiples aplicaciones Quarkus que se ejecutan en modo dev compartan un único servidor.

Dev Services for Redis inicia el contenedor con la etiqueta quarkus-dev-service-redis que se utiliza para identificar el contenedor.

Si necesitas varios servidores (compartidos), puedes configurar el atributo quarkus.redis.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 redis.

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.redis.devservices.shared=false.