As of 3.0 OpenTSDB has a much more flexible configuration system with features like:
OpenTSDB is now configured via one or more sources that are flattened into a single application wide configuration consisting of keys and values. Multiple sources can be provided with the same keys but different values and later values will override the earlier values. As an example, a common config may be available over HTTP with many settings but a local config may override some of those settings for a specific environment.
Available built-in providers include:
The config.providers key is used to set the providers and order that they're loaded in. Providers are separated by commas and the last configuration in the list is loaded first, with earlier configs over-ridding the later configs (NOTE: If this is a pain we can reverse it before release, let us know what ya'll think). And example config may look like this:
--config.providers=secrets://net.opentsdb.configuration.providers.AWSSecretsProvider:AWS,https://tsdbconfig.mysite.com/stage/elasticsearch.yaml,https://tsdbconfig.mysite.com/stage/tsdr.yaml,https://tsdbconfig.mysite.com/stage/hbase.yaml,https://tsdbconfig.mysite.com/stage/common.yaml
With secrets, files and remote files, the configuration format uses protocols like https://, file:// or secrets://. These protocols determine which plugin or built-in module parses the config. For remote and files, the suffix will also determine the parser.
Because multiple configurations are flattened into a single structure, key values in earlier providers will be overwritten by those in later providers. For example, lets assume the following providers config: --config.providers=https://tsdbconfig.mysite.com/stage/tsdr.yaml,https://tsdbconfig.mysite.com/stage/common.yaml.
Lets say https://tsdbconfig.mysite.com/stage/common.yaml contains:
tsd.stats.environment: development
and https://tsdbconfig.mysite.com/stage/tsdr.yaml defines
tsd.stats.environment: stage
since we're in stage. The final value read by TSDB for tsd.stats.environment will be stage.
The default provider set is PropertiesFile,Environment,SystemProperties,CommandLine,RuntimeOverride where the properties file will automatically search for Java property formatted files in the following locations:
This is useful when migrating from an OpenTSDB 2.0 config file.
When secrets need to be loaded (and particularly when they need to be used during bootstraping) a path to a plugin directory can be provided via the config.plugin.path key. For example --config.plugin.path=/usr/share/opentsdb/plugins can be given on the command line.
On TSD startup, the configuration class will look for config.providers and config.plugin.path in the following locations and take the first value found:
All file based or remote configurations will be reloaded, by default, every 5 minutes. To change the interval, set config.reload.interval to an integer in seconds. This feature allows for common tunnable parameters to be changed during runtime without having to restart the TSD.