Skip to content

VerneMQ

VerneMQ is a high-performance, distributed MQTT message broker designed for IoT and messaging applications. Built on Erlang/OTP, it offers excellent scalability, reliability, and fault tolerance. VerneMQ is designed to handle millions of concurrent connections and messages, making it ideal for IoT applications.

To get started with VerneMQ, follow these steps:

After starting the MAPLE Platform with docker compose up -d, you can access the VerneMQ dashboard by navigating to http://localhost:8889 in your web browser. The dashboard provides an overview of the broker’s status, connections, and metrics.

The VerneMQ broker is configured with secure authentication through environment variables:

  • MQTT_USER: Username for MQTT authentication (configured in .env)
  • MQTT_PASSWORD: Password for MQTT authentication (configured in .env)
  • Anonymous access: Disabled for security

The broker automatically creates the specified user during initialization, ensuring secure access to the MQTT broker.

VerneMQ is configured to operate on both the backend and frontend networks:

  • Backend Network: Internal communication with other services
  • Frontend Network: External client access
  • Ports:
    • 1883: MQTT (standard)
    • 8883: MQTT over TLS/SSL
    • 8080: MQTT over WebSockets
    • 8889: HTTP status/metrics endpoint

The VerneMQ configuration includes several security features:

  • Anonymous access disabled: Only authenticated users can connect
  • Environment variable configuration: Credentials are securely managed through Docker secrets
  • Health checks: Automated monitoring of broker health
  • Resource limits: Memory and CPU constraints to prevent resource exhaustion

To connect MQTT clients to the VerneMQ broker, use the following connection parameters:

Terminal window
# Basic MQTT connection
mosquitto_pub -h localhost -p 1883 -u "$MQTT_USER" -P "$MQTT_PASSWORD" -t "test/topic" -m "Hello World"
# MQTT over TLS
mosquitto_pub -h localhost -p 8883 -u "$MQTT_USER" -P "$MQTT_PASSWORD" -t "test/topic" -m "Hello World" --capath /etc/ssl/certs
# MQTT over WebSockets
# Use WebSocket client libraries with URL: ws://localhost:8080/mqtt

LEAF adapters use a structured topic hierarchy for organizing data:

<organisation>/<department>/<adapter_id>/<instance_id>/experiment/<experiment_id>/measurement/<measurement>
# Where <xxx> is a placeholder for the actual value.

This structure is coordinated through the YAML configuration file in combination with the adapter used.

The VerneMQ dashboard at http://localhost:8889 provides:

  • Connection statistics
  • Message throughput metrics
  • Client connection details
  • System resource usage
  • Real-time monitoring of MQTT activity

Common issues and solutions:

  1. Connection Refused: Check if VerneMQ is running with docker compose ps vernemq
  2. Authentication Failed: Verify MQTT_USER and MQTT_PASSWORD in .env file
  3. No Messages: Check topic structure and client subscriptions
  4. High Memory Usage: Monitor connection count and message rates

For detailed logs, use:

Terminal window
docker compose logs -f vernemq