Stand with Ukraine flag
Try it now Pricing
MQTT Broker
Community Edition Professional Edition Cloud Edge PE Edge IoT Gateway License Server Trendz Analytics Mobile Application PE Mobile Application MQTT Broker
Installation > Installing TBMQ using Docker (Windows)
Getting Started Documentation
Architecture API FAQ
On this page

Installing TBMQ using Docker (Windows)

This guide will help you to install and start standalone TBMQ using Docker on Windows. If you are looking for a cluster installation instruction, please visit cluster setup page.

Prerequisites

To run TBMQ on a single machine you will need at least 2Gb of RAM.

Installation

Execute the following commands to download the script that will install and start TBMQ.

Note: make sure the downloaded PowerShell scripts are allowed to run on your system.

  • Open PowerShell (Run as Administrator).
  • (Optional) Get the current execution policy. It determines the level of security for running scripts on a system. For example, if Restricted is returned, it means PowerShell doesn’t execute any scripts.
1
Get-ExecutionPolicy
  • (Optional) Change the current execution policy if required. Set it to the one that will allow you to run PowerShell scripts and the one that suits your security requirements. For example, Unrestricted is the least restrictive setting that allows all scripts to be executed.
1
Set-ExecutionPolicy Unrestricted
  • Install TBMQ
1
2
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq/release-1.3.0/msa/tbmq/configs/windows/tbmq-install-and-run.ps1" `
-OutFile ".\tbmq-install-and-run.ps1"; .\tbmq-install-and-run.ps1

The script downloads the docker-compose.yml file, creates necessary docker volumes, installs the database for TBMQ, and starts TBMQ. Key configuration points for TBMQ in docker-compose file:

  • 8083:8083 - connect local port 8083 to exposed internal HTTP port 8083;
  • 1883:1883 - connect local port 1883 to exposed internal MQTT port 1883;
  • 8084:8084 - connect local port 8084 to exposed internal MQTT over WebSockets port 8084;
  • tbmq-postgres-data:/var/lib/postgresql/data - maps the tbmq-postgres-data volume to TBMQ DataBase data directory;
  • tbmq-kafka-data:/bitnami/kafka - maps the tbmq-kafka-data volume to Kafka data directory;
  • tbmq-logs:/var/log/thingsboard-mqtt-broker - maps the tbmq-logs volume to TBMQ logs directory;
  • tbmq-data:/data - maps the tbmq-data volume to TBMQ data directory that contains .firstlaunch file after the DB is installed;
  • tbmq - friendly local name of this machine;
  • restart: always - automatically start TBMQ in case of system reboot and restart in case of failure;
  • SECURITY_MQTT_BASIC_ENABLED: "true" - enables MQTT basic security. Note: by default security is disabled.

Note: In case the TBMQ is being installed on the same host where ThingsBoard is already running, the following issue can be seen:

1
Error response from daemon: ... Bind for 0.0.0.0:1883 failed: port is already allocated

In order to fix this, you need to expose another host’s port for the TBMQ container, i.e. change the 1883:1883 line in the downloaded docker-compose.yml file with, for example, 1889:1883. After that re-run the script.

1
.\tbmq-install-and-run.ps1

Once the installation process is complete you can access TBMQ UI by visiting the following URL http://{your-host-ip}:8083 in your browser (e.g. http://localhost:8083).

You should see TBMQ login page. Use the following default credentials for System Administrator:

Username:

Password:

1
sysadmin

On the first user log-in you will be asked to change the default password to the preferred one and then re-login using the new credentials.

Logs, stop and start commands

In case of any issues you can examine service logs for errors. For example to see TBMQ logs execute the following command:

1
docker compose logs -f tbmq

To stop the containers:

1
docker compose stop

To start the containers:

1
docker compose start

Upgrading

Doc info icon

Please note:
For the TBMQ 1.3.0 version, the installation scripts were updated to contain a new 8084 port for MQTT over WebSockets. This is needed for the correct work with the WebSocket client page.

Please pull the latest configuration files or modify your existing ones to include a new port entry. To find more details please visit the following link.

Once the required changes are made, you should be able to connect the MQTT client on the WebSocket client page. Otherwise, please contact us, so we can answer any questions and provide our help if needed.

In order to update to the latest version, execute the following commands:

1
2
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/thingsboard/tbmq/release-1.3.0/msa/tbmq/configs/windows/tbmq-upgrade.ps1" `
-OutFile ".\tbmq-upgrade.ps1"; .\tbmq-upgrade.ps1

NOTE: replace db_url, db_username, and db_password variables in the script with the corresponding values used during DB initialization.

Next steps