A primer on HiveMQ Broker: Difference between revisions
No edit summary |
|||
| Line 18: | Line 18: | ||
# In the unpacked directory for HiveMQ, expand the '''bin''' subdirectory, the right-click '''run.bat''', and select "Run as administrator". | # In the unpacked directory for HiveMQ, expand the '''bin''' subdirectory, the right-click '''run.bat''', and select "Run as administrator". | ||
# The HiveMQ should now start, showing various log messages in the console window. | # The HiveMQ should now start, showing various log messages in the console window. | ||
This is now an insecure HiveMQ deployment. Any MQTT client can connect to the broker with a full set of permissions. The MQTT broker is accepting TCP connections on port 1883. You can access the HiveMQ Control Center on http://localhost:8080/ . The default username is '''admin''', the default password is '''hivemq'''. Press Ctrl+C in the console window to stop HiveMQ. | This is now an insecure HiveMQ deployment. Any MQTT client can connect to the broker with a full set of permissions. The MQTT broker is accepting TCP connections on port 1883. | ||
You can access the HiveMQ Control Center on http://localhost:8080/ . The default username is '''admin''', the default password is '''hivemq'''. | |||
Press Ctrl+C in the console window to stop HiveMQ. | |||
The HiveMQ platform will not start by itself when the computer is restarted. Repeat the '''run.bat''' step in order to start it again. | The HiveMQ platform will not start by itself when the computer is restarted. Repeat the '''run.bat''' step in order to start it again. | ||
Revision as of 15:02, 1 August 2025
Introduction
HiveMQ Broker is a commercial MQTT Broker based on Java.
Web site: https://www.hivemq.com/products/mqtt-broker/
Download: https://www.hivemq.com/download/ (the whole HiveMQ Platform)
Documentation: https://docs.hivemq.com/hivemq/latest/user-guide/index.html (the whole HiveMQ Platform)
Installation
See https://docs.hivemq.com/hivemq/latest/user-guide/getting-started.html . We have tested the following installation steps on Windows, with HiveMQ 4.42.0.
- Unpack the downloaded ZIP file.
- In the unpacked directory for HiveMQ, expand the bin subdirectory, the right-click run.bat, and select "Run as administrator".
- You may get an error similar to this: "ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptium.net/?variant=openjdk21".
- Visit https://adoptium.net/temurin/releases and download the .MSI for Windows.
- Run the downloaded installer, keeping all defaults.
- In the unpacked directory for HiveMQ, expand the bin subdirectory, the right-click run.bat, and select "Run as administrator".
- The HiveMQ should now start, showing various log messages in the console window.
This is now an insecure HiveMQ deployment. Any MQTT client can connect to the broker with a full set of permissions. The MQTT broker is accepting TCP connections on port 1883.
You can access the HiveMQ Control Center on http://localhost:8080/ . The default username is admin, the default password is hivemq.
Press Ctrl+C in the console window to stop HiveMQ.
The HiveMQ platform will not start by itself when the computer is restarted. Repeat the run.bat step in order to start it again.
Configuration
See https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html . For MQTT listeners, see https://docs.hivemq.com/hivemq/latest/user-guide/listeners.html .
WebSockets
In order to allow the MQTT broker be accessed via WebSockets, use the following in config.xml:
<?xml version="1.0"?>
<hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<listeners>
<websocket-listener>
<port>8000</port>
<bind-address>0.0.0.0</bind-address>
<path>/mqtt</path>
<name>my-websocket-listener</name>
<subprotocols>
<subprotocol>mqttv3.1</subprotocol>
<subprotocol>mqtt</subprotocol>
</subprotocols>
<allow-extensions>true</allow-extensions>
</websocket-listener>
...
</listeners>
...
</hivemq>
Note that you cannot use port 8080 in the default configuration, because it us occupied by the HiveMQ Control Center.
Restart the HiveMQ Platform after making the configuration change, and possibly open the firewall port as needed.