Skip to main content

Setting Environment Variables

Databend offers you the flexibility to configure your Meta and Query nodes in two ways: using environment variables or configuration files. Moreover, you have the option to utilize environment variables to point to custom configuration files. This capability empowers you to make modifications without disrupting the default setups. This is especially advantageous when you require swift adjustments, are working with containers, or need to safeguard sensitive data.

note
  • A mapping relationship exists between the parameters set through environment variables and those specified in configuration files. In cases where a configuration parameter is defined both via an environment variable and in a configuration file, Databend will prioritize the value provided by the environment variable.

  • Not all configurations can be managed solely through environment variables. In some cases, adjustments might necessitate modifications within the configuration files rather than relying on environment variables.

Setting Configuration File Paths

METASRV_CONFIG_FILE and CONFIG_FILE are environment variables used to designate the locations of your configuration files, databend-meta.toml and databend-query.toml. They provide a way to tailor the paths of configuration files in Databend. If you'd like to depart from the default setup and opt for custom configuration file locations, these variables empower you to specify the exact paths for your files.

Example
export METASRV_CONFIG_FILE='/etc/databend/databend-meta.toml'
export CONFIG_FILE='/etc/databend/databend-query.toml'

Meta Environment Variables

Below is a list of available environment variables, each correspondingly mapped to parameters found in the configuration file databend-meta.toml. For detailed explanations of each parameter, see Meta Configurations.

Environment VariableMapped to
METASRV_LOG_DIRlog_dir
ADMIN_API_ADDRESSadmin_api_address
METASRV_GRPC_API_ADDRESSgrpc_api_address
METASRV_GRPC_API_ADVERTISE_HOSTgrpc_api_advertise_host
KVSRV_IDid
KVSRV_RAFT_DIRraft_dir
KVSRV_API_PORTraft_api_port
KVSRV_LISTEN_HOSTraft_listen_host
KVSRV_ADVERTISE_HOSTraft_advertise_host
KVSRV_SINGLEsingle

Query Environment Variables

The parameters under the [query] and [storage] sections in the configuration file databend-query.toml can be configured using environment variables. The names of the environment variables are formed by combining the word QUERY or STORAGE with the corresponding parameter names using underscores.

Databend also accepts environment variables from storage services when they match Databend's environment variables. This allows you to work with the environment variable naming conventions you are most familiar with, eliminating the need to remember additional variable names and simplifying your configuration process.

To illustrate with an example, if you want to set the access key ID for S3 using an environment variable, you have the flexibility to use either STORAGE_S3_ACCESS_KEY_ID provided by Databend or the well-known AWS_ACCESS_KEY_ID typically associated with AWS S3.

Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today