How to change configuration
TBMQ reads its settings from environment variables. This page shows where to set them in each deployment and how to apply a change. The parameters and their defaults are listed in the TBMQ configuration reference and the Integration Executor configuration reference.
Configuration file format
Section titled “Configuration file format”The broker reads thingsboard-mqtt-broker.yml and the Integration Executor reads tbmq-integration-executor.yml. Each
parameter names an environment variable and a default:
stats: # Print interval for statistics (in ms). Defaults to 1 minute. print-interval-ms: "${STATS_PRINT_INTERVAL_MS:60000}"Here STATS_PRINT_INTERVAL_MS is the environment variable and 60000 is the default. To override the value, set the
variable in your deployment, for example STATS_PRINT_INTERVAL_MS=15000.
The configuration is read at startup, so a change takes effect only after the TBMQ containers or pods restart. Each section below shows how to restart them.
Docker
Section titled “Docker”The Docker and
Docker on Windows installations
keep their settings in docker-compose.yml. Add the variable to the environment section of the tbmq service, or of
the tbmq-integration-executor service for Integration Executor settings:
tbmq: environment: STATS_PRINT_INTERVAL_MS: "15000"Apply the change from the directory that contains docker-compose.yml. Docker Compose recreates only the containers
whose configuration changed; the data stays in the Docker volumes:
docker compose up -dDocker Compose cluster
Section titled “Docker Compose cluster”The Docker Compose cluster
splits its settings across several files in the directory that holds its docker-compose.yml:
| File | Settings |
|---|---|
tbmq.env |
Broker settings, shared by both TBMQ nodes |
tbmq-integration-executor.env |
Integration Executor settings |
cache-valkey.env, cache-valkey-cluster.env or cache-valkey-sentinel.env |
Valkey connection, for the cache mode that CACHE in .env selects |
.env |
Image version, container names, the cache mode, and JAVA_OPTS |
JAVA_OPTS in .env reaches the containers only through the JAVA_OPTS: "${JAVA_OPTS}" line in the environment
section of each TBMQ and Integration Executor service in docker-compose.yml, which ships commented out. Uncomment it
in every service that should use the value.
Restart the TBMQ nodes and Integration Executors. The script recreates the containers whose image or settings changed and leaves PostgreSQL, Kafka, Valkey and HAProxy running:
./scripts/docker-start-tbmq.shKubernetes scripts
Section titled “Kubernetes scripts”The Minikube,
AWS,
Azure and
GCP guides run
TBMQ as the tbmq StatefulSet and the Integration Executor as the tbmq-integration-executor StatefulSet, in the
thingsboard-mqtt-broker namespace. Set a variable in one of these places:
- The
envlist of thetbmqcontainer intbmq.yml, or of the Integration Executor container intbmq-ie.yml. - The ConfigMaps that the broker reads with
envFrom:tbmq-db-configmap.ymlfor PostgreSQL (on Minikube, thetbmq-db-configConfigMap intbmq-configmap.yml),tbmq-cache-configmap.ymlfor the cache on AWS, Azure and GCP, and the Kafka topic settings inkafka/managed/tbmq-kafka-topics-configmap.ymlon GCP. JAVA_OPTSin theconfkey oftbmq-configmap.ymlortbmq-ie-configmap.yml.
A change to tbmq.yml or tbmq-ie.yml restarts the pods by itself. Apply the file, then wait for the rollout, which
replaces the pods one at a time:
kubectl apply -f tbmq.ymlkubectl rollout status statefulset/tbmq -n thingsboard-mqtt-broker --timeout=600sA ConfigMap change doesn’t restart the pods. Apply the ConfigMap, then restart the StatefulSet that reads it:
kubectl apply -f tbmq-db-configmap.ymlkubectl rollout restart statefulset/tbmq -n thingsboard-mqtt-brokerkubectl rollout status statefulset/tbmq -n thingsboard-mqtt-broker --timeout=600sFor the Integration Executor, use tbmq-ie.yml, tbmq-ie-configmap.yml and statefulset/tbmq-integration-executor.
Helm chart
Section titled “Helm chart”The Helm guides set
broker variables in tbmq.customEnv and Integration Executor variables in tbmq-ie.customEnv of your values.yaml:
tbmq: customEnv: STATS_PRINT_INTERVAL_MS: "15000"If you point existingConfigMap or existingJavaOptsConfigMap at your own ConfigMap, a variable that its conf key
exports overrides the same variable in customEnv.
Upgrade the release with the same values file. The chart restarts the pods whose configuration changed, one at a time:
helm upgrade my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq -f values.yamlkubectl rollout status statefulset/my-tbmq-cluster-tbmq-node -n tbmq --timeout=600sLogging configuration
Section titled “Logging configuration”Log levels live in logback.xml, not in environment variables. TBMQ re-reads the file every 10 seconds, so when an
edit applies depends on how the file reaches the container:
-
Docker Compose cluster: within 10 seconds after
./scripts/docker-refresh-config.shcopies it into the volume. -
Kubernetes scripts: after Kubernetes syncs the applied ConfigMap into the pods, which can take a minute or more.
-
Helm chart: you can’t change the default logging configuration through chart values. Use your own ConfigMap instead:
- Create a ConfigMap with a
logbackkey that holds yourlogback.xml. - Set
existingLogbackConfigMapto its name undertbmq(broker) ortbmq-ie(Integration Executor), and runhelm upgrade. - To change log levels later, edit the ConfigMap and run
kubectl apply. The pods pick up the change after Kubernetes syncs it, as with the Kubernetes scripts.
Step 3 needs chart 2.3.2 or later. With an older chart, also restart the pods:
kubectl rollout restart statefulset/my-tbmq-cluster-tbmq-node statefulset/my-tbmq-cluster-tbmq-ie -n tbmq. - Create a ConfigMap with a
See Enabling component logs for where each deployment keeps the file.
Was this helpful?