Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. We suggest using Systemd service to run HiveMQ as a service.

  2. Copy the HiveMQ service file to the systemd directory:

    Code Block
    sudo cp /opt/hivemq/bin/init-script/hivemq.service /etc/systemd/system/hivemq.service
  3. Edit the HiveMQ service file to run as root instead of the default hivemq user:

    Code Block
    sudo nano /etc/systemd/system/hivemq.service

    Update Service Group and User as “root”.

  4. Reload systemd to apply the changes made to the HiveMQ service file. Use following command to do that.

    Code Block
    sudo systemctl daemon-reload
  5. Enable HiveMQ to start on boot. Following command configures systemd to start the HiveMQ service automatically on boot.

    Code Block
    sudo systemctl enable hivemq
  6. Manually start the HiveMQ service:

    Code Block
    sudo systemctl start hivemq.service
  7. Check the status of the HiveMQ service:

    Code Block
    sudo systemctl status hivemq.service

    This command displays the status of the HiveMQ service, including whether it is running or not.

  8. Debug the HiveMQ startup process with systemd:

    Code Block
    sudo journalctl | grep -i hivemq
  9. Check if HiveMQ is listening to the default port for MQTT:

    Code Block
    sudo netstat -an | grep 1883
  10. In case firewalls such as UFW are enabled, Please try disabling these and retry to run the hivemq service. Or allow mqtt and control centre ports configured in HiveMQ’s config.xml to become accessible. Following is the command to disable UFW

    Code Block
    sudo ufw disable
  11. Even after doing all of the above still service fails to restart then this could be because of Ubuntu AppArmor or SELinux configurations that may interfere with the service. Please try disabling them and retry if the service starts without issue. Following are the commands to stop and disable the AppArmor service.

    Code Block
    sudo systemctl stop apparmor.service
    sudo systemctl disable apparmor.service
  12. In case the issue persists, please reach out to support via the Support portal for further help.

...