Connect your first client
Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.
This guide describes how to install and start a standalone TBMQ instance using Docker Desktop on Windows. For cluster installation, see the cluster setup page.
The install script runs TBMQ, PostgreSQL, Kafka, Valkey, and the Integration Executor as Docker containers on one host. Once it is running, TBMQ listens on these ports:
One host · Docker Desktop
Ports
Before proceeding, ensure you have an active TBMQ license. If you don’t have one yet, visit the Pricing page, choose a pay-as-you-go subscription or a perpetual license, and use the calculator to size your deployment — session and throughput limits, production and development instances, and any add-ons — to obtain your license key.
Installation takes three steps: configure the license key, run the install script, then log in to the TBMQ UI.
Open PowerShell as Administrator and go to the directory where you want to keep the TBMQ files.
The scripts download and read docker-compose.yml in the current directory.
Download the docker-compose.yml file.
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq-pe-docker-compose/release-2.4.2/basic/docker-compose.yml" `-OutFile ".\docker-compose.yml"Set your license key.
Open the downloaded docker-compose.yml, find TBMQ_LICENSE_SECRET, and replace YOUR_LICENSE_KEY_HERE with your actual license key.
From the same directory, run the following commands to download and run the TBMQ install script. It uses the
docker-compose.yml you edited instead of downloading a new one:
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq-pe-docker-compose/release-2.4.2/basic/windows/tbmq-install-and-run.ps1" `-OutFile ".\tbmq-install-and-run.ps1"; .\tbmq-install-and-run.ps1The script downloads the docker-compose.yml file if it is not already in the current directory, creates the necessary Docker volumes, installs the database, and starts TBMQ.
It then follows the container logs; press Ctrl+C to stop following them — TBMQ keeps running.
docker-compose.yml| Setting | Purpose |
|---|---|
8083:8083 |
Exposes the HTTP UI on port 8083 |
1883:1883 |
Exposes the MQTT port 1883 |
8084:8084 |
Exposes MQTT over WebSockets on port 8084 |
tbmq-valkey-data:/data |
Valkey data volume |
tbmq-postgres-data:/var/lib/postgresql/data |
PostgreSQL data volume |
tbmq-kafka-data:/var/lib/kafka/data |
Kafka data volume |
tbmq-kafka-secrets:/etc/kafka/secrets, tbmq-kafka-config:/mnt/shared/config |
Kafka secrets and configuration volumes |
tbmq-logs:/var/log/thingsboard-mqtt-broker |
TBMQ logs volume |
tbmq-data:/data |
TBMQ data directory (contains .firstlaunch after DB installation) |
tbmq-ie-logs:/var/log/tbmq-integration-executor |
Integration Executor logs volume |
tbmq |
Docker service name |
tbmq-integration-executor |
Docker service name of the Integration Executor, which runs integrations |
restart: always |
Auto-restarts TBMQ on system reboot or failure |
The PE file also sets the license:
| Setting | Purpose |
|---|---|
TBMQ_LICENSE_SECRET |
The PE license key you set in Configure the license key |
TBMQ_LICENSE_INSTANCE_DATA_FILE: /data/tbmq-instance-license.data |
Path to the auto-generated instance data file used to identify this TBMQ instance |
Open the UI.
Once installation is complete, access the TBMQ UI at http://{your-host-ip}:8083 in your browser (e.g., http://localhost:8083).
You should see the TBMQ login page.
Sign in as System Administrator.
Use the default System Administrator credentials:
sysadmin@thingsboard.orgsysadminChange the default password.
On first login, you are prompted to change the default password and re-login with the new credentials.
Run these commands from the directory that contains docker-compose.yml.
docker compose logs -f tbmqdocker compose stopdocker compose startFor full version history and supported upgrade paths, see the upgrade instructions page. If the documentation does not cover your specific upgrade path, contact us for guidance.
What each upgrade needs before you run the script — select a version for its full notes:
| Upgrade to | Before running the upgrade script |
|---|---|
| 2.4.2 | Create an empty .tbmq-upgrade.env. Check SCRAM-only authentication and Kafka integrations |
| 2.4.1 | Create an empty .tbmq-upgrade.env. If you set MQTT_TOPIC_MAX_SEGMENTS_COUNT, raise it by 1 |
| 2.4.0 | Create an empty .tbmq-upgrade.env. If you scrape metrics, update queries for the renamed Prometheus metrics |
| 2.3.0 | Create an empty .tbmq-upgrade.env |
| TBMQ to TBMQ PE | Add the PE license variables to docker-compose.yml and create .tbmq-upgrade.env for the CE-to-PE migration |
Backing up your PostgreSQL database before upgrading is highly recommended but optional. For further guidance, follow the backup and restore instructions.
This is a standard upgrade from v2.4.1PE. No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.
The upgrade script requires a .tbmq-upgrade.env file.
If it does not already exist from a previous upgrade, create an empty one:
New-Item -Path .tbmq-upgrade.env -ItemType File -ForceThen proceed with the upgrade.
No third-party component changes are required, and the upgrade only records the new schema version — no table is created or altered and no data is migrated.
The upgrade script requires a .tbmq-upgrade.env file.
If it does not already exist from a previous upgrade, create an empty one:
New-Item -Path .tbmq-upgrade.env -ItemType File -ForceThen proceed with the upgrade.
No third-party component changes are required.
The upgrade creates the dropped_msg table used by dropped message analytics; no existing data is changed.
The upgrade script requires a .tbmq-upgrade.env file.
If it does not already exist from a previous upgrade, create an empty one:
New-Item -Path .tbmq-upgrade.env -ItemType File -ForceThen proceed with the upgrade.
No third-party component changes are required — the official images are already in use since v2.2.0.
The upgrade script requires a .tbmq-upgrade.env file.
If it does not already exist from a previous upgrade, create an empty one:
New-Item -Path .tbmq-upgrade.env -ItemType File -ForceThen proceed with the upgrade.
CE-to-PE migration is supported for the same version only. If you are on an earlier CE version, upgrade TBMQ CE to the latest version first. For all supported paths, see the upgrade instructions.
Add the PE environment variables.
Before upgrading, update your docker-compose.yml to include the PE-specific environment variables:
TBMQ_LICENSE_SECRET — your license key from the license step;TBMQ_LICENSE_INSTANCE_DATA_FILE — path to the auto-generated instance data file (e.g. /data/tbmq-instance-license.data).Create the .tbmq-upgrade.env file.
@'JAVA_TOOL_OPTIONS=-Dinstall.upgrade.from_version=ce'@ | Set-Content -Path .tbmq-upgrade.env -Encoding UTF8Run the upgrade.
Then proceed with the upgrade.
Go to your installation directory.
Run the upgrade from the directory that contains docker-compose.yml and .tbmq-upgrade.env.
Download the upgrade script.
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq-pe-docker-compose/release-2.4.2/basic/windows/tbmq-upgrade.ps1" `-OutFile ".\tbmq-upgrade.ps1"The script upgrades TBMQ PE 2.4.1PE, or TBMQ 2.4.2 (CE), to 2.4.2PE. It changes the tbmq and
tbmq-integration-executor image tags in docker-compose.yml, keeping the original as docker-compose.yml.bak, and stops
with Failed to replace the image version if the file references neither version.
Check the connection settings.
The script connects to PostgreSQL and Valkey with the default settings from docker-compose.yml. If you changed them,
edit the $db_url, $db_username, $db_password, and $valkey_url variables in tbmq-upgrade.ps1 to match
before running it.
Run the upgrade.
.\tbmq-upgrade.ps1After the database upgrade, the script asks you to confirm removing the stopped tbmq container
(Going to remove …-tbmq-1). Answer y; the script then starts TBMQ on the new version.
The upgrade script stops the tbmq service while the upgrade runs and starts it again afterwards, so expect a brief interruption.
To enable MQTT over SSL/TLS (MQTTS) in TBMQ, provide valid SSL certificates and configure TBMQ to use them.
For details on supported formats and configuration options, see the MQTT over SSL guide.
Prepare SSL certificates.
Obtain a valid SSL certificate and private key. For example:
mqttserver.pem — public certificate (may include the full chain)mqttserver_key.pem — private keyMount certificates into the container.
In your docker-compose.yml, mount the directory containing the certificates into the tbmq service:
services: tbmq: volumes: - tbmq-logs:/var/log/thingsboard-mqtt-broker - tbmq-data:/data - PATH_TO_CERTS:/config/certificatesReplace PATH_TO_CERTS with the path to your certificate files.
TBMQ runs as the thingsboard user (UID 799) inside the container and must be able to read both files.
If TBMQ cannot read a file, it fails to start and logs Permission denied for that file.
Configure environment variables.
Add the following variables to the tbmq service environment in docker-compose.yml:
LISTENER_SSL_ENABLED: "true"LISTENER_SSL_PEM_CERT: "/config/certificates/mqttserver.pem"LISTENER_SSL_PEM_KEY: "/config/certificates/mqttserver_key.pem"LISTENER_SSL_PEM_KEY_PASSWORD: "server_key_password"Leave LISTENER_SSL_PEM_KEY_PASSWORD empty if your private key is not password-protected.
Expose the MQTTS port.
In docker-compose.yml, add the port to the tbmq service:
services: tbmq: ports: - "8083:8083" - "1883:1883" - "8084:8084" - "8883:8883"Restart TBMQ.
.\tbmq-install-and-run.ps1Once restarted, MQTT clients can securely connect to port 8883 using TLS/SSL.
Set up client credentials, then publish and subscribe with an MQTT client. See Getting started.
Choose the authentication provider that fits your clients. See Security overview.
Change broker settings through environment variables in docker-compose.yml.
See How to change configuration.
Track sessions, throughput, and resource usage as traffic grows. See Monitoring.
Was this helpful?