Skip to content
Stand with Ukraine flag

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.

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.

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:

docker-compose.yml
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:

Terminal window
docker compose up -d

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:

Terminal window
./scripts/docker-start-tbmq.sh

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 env list of the tbmq container in tbmq.yml, or of the Integration Executor container in tbmq-ie.yml.
  • The ConfigMaps that the broker reads with envFrom: tbmq-db-configmap.yml for PostgreSQL (on Minikube, the tbmq-db-config ConfigMap in tbmq-configmap.yml), tbmq-cache-configmap.yml for the cache on AWS, Azure and GCP, and the Kafka topic settings in kafka/managed/tbmq-kafka-topics-configmap.yml on GCP.
  • JAVA_OPTS in the conf key of tbmq-configmap.yml or tbmq-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:

Terminal window
kubectl apply -f tbmq.yml
kubectl rollout status statefulset/tbmq -n thingsboard-mqtt-broker --timeout=600s

A ConfigMap change doesn’t restart the pods. Apply the ConfigMap, then restart the StatefulSet that reads it:

Terminal window
kubectl apply -f tbmq-db-configmap.yml
kubectl rollout restart statefulset/tbmq -n thingsboard-mqtt-broker
kubectl rollout status statefulset/tbmq -n thingsboard-mqtt-broker --timeout=600s

For the Integration Executor, use tbmq-ie.yml, tbmq-ie-configmap.yml and statefulset/tbmq-integration-executor.

The Helm guides set broker variables in tbmq.customEnv and Integration Executor variables in tbmq-ie.customEnv of your values.yaml:

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:

Terminal window
helm upgrade my-tbmq-cluster tbmq-helm-chart/tbmq-cluster -n tbmq -f values.yaml
kubectl rollout status statefulset/my-tbmq-cluster-tbmq-node -n tbmq --timeout=600s

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.sh copies 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:

    1. Create a ConfigMap with a logback key that holds your logback.xml.
    2. Set existingLogbackConfigMap to its name under tbmq (broker) or tbmq-ie (Integration Executor), and run helm upgrade.
    3. 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.

See Enabling component logs for where each deployment keeps the file.