Dynamic Config Providers

Druid relies on dynamic config providers to supply multiple related sets of credentials, secrets, and configurations within a Druid extension. Dynamic config providers are intended to eventually replace PasswordProvider.

By default, Druid includes an environment variable dynamic config provider that supports Kafka consumer configuration in Kafka ingestion.

To develop a custom extension of the DynamicConfigProvider interface that is registered at Druid process startup, see Adding a new DynamicConfigProvider implementation.

Environment variable dynamic config provider

You can use the environment variable dynamic config provider (EnvironmentVariableDynamicConfigProvider) to store passwords or other sensitive information using system environment variables instead of plain text configuration.

The environment variable dynamic config provider uses the following syntax:

  1. druid.dynamic.config.provider={"type": "environment","variables":{"secret1": "SECRET1_VAR","secret2": "SECRET2_VAR"}}
FieldTypeDescriptionRequired
typeStringdynamic config provider typeYes: environment
variablesMapenvironment variables that store the configuration informationYes

When using the environment variable config provider, consider the following:

  • If you manually specify a configuration key-value pair and use the dynamic config provider for the same key, Druid uses the value from the dynamic config provider.
  • For use in a supervisor spec, environment variables must be available to the system user that runs the Overlord service and that runs the Peon service.

The following example shows how to configure environment variables to store the SSL key and truststore passwords for Kafka.

On the Overlord and Peon machines, set the following environment variables for the system user that runs the Druid services:

  1. export SSL_KEY_PASSWORD=mysecretkeypassword
  2. export SSL_KEYSTORE_PASSWORD=mysecretkeystorepassword
  3. export SSL_TRUSTSTORE_PASSWORD=mysecrettruststorepassword

When you define the consumer properties in the supervisor spec, use the dynamic config provider to refer to the environment variables:

  1. ...
  2. "consumerProperties": {
  3. "bootstrap.servers": "localhost:9092",
  4. "ssl.keystore.location": "/opt/kafka/config/kafka01.keystore.jks",
  5. "ssl.truststore.location": "/opt/kafka/config/kafka.truststore.jks",
  6. "druid.dynamic.config.provider": {
  7. "type": "environment",
  8. "variables": {
  9. "ssl.key.password": "SSL_KEY_PASSWORD",
  10. "ssl.keystore.password": "SSL_KEYSTORE_PASSWORD",
  11. "ssl.truststore.password": "SSL_TRUSTSTORE_PASSWORD"
  12. }
  13. }
  14. },
  15. ...

When connecting to Kafka, Druid replaces the environment variables with their corresponding values.