[question] How to create `aedes` broker cluster in Docker?

Open
#152 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
docker, javascript, mongodb, node.js
Domain
backend, cli, databases

Research direction

Start by reading the referenced aedes cluster example, the aedes-cli persistence and emitters documentation, and the supplied Docker Compose and dockerConfig.js examples. The issue does not identify a specific code change; done would require a decided, reproducible explanation of the supported clustering setup and its configuration.

Written by the indexing model from the issue text.

Description

question

First asked on SO.


I need to create a MQTT broker cluster. I want to use aedes (as I already use it, albeit without cluster) and Docker. Note that I have never created a cluster before (with nor without Docker).

Here I found official example how to create a cluster using aedes, but I was thinking about using aedes-cli Docker image.

Now, I have no idea which is better: should I create separate containers per broker (similarly to this question) or use mqemitter-redis/mqemitter-mongodb (as the aedes-cli docs suggest).

As for creating separate containers, I have no idea how to connect them.

As for using mqemitter-redis/mqemitter-mongodb, I have no idea how to setup them in the aedes-cli config file.

I have no need for data persistance accross broker cluster restarts. All I need is to distribute the messages accross multiple brokers in order to improve the runtime performance.


Below is a working, single-broker configuration.

  • aedes.yml:
version: '3.7'
services:
  aedes:
    container_name: aedes
    image: moscajs/aedes:latest
    restart: always
    stop_signal: SIGINT
    network_mode: host
    command: -c /data/dockerConfig.js
    volumes:
      - /some/path/mqtt:/data
  mongo:
    container_name: mongo
    restart: always
    network_mode: host
    logging:
      driver: none
    image: mvertes/alpine-mongo
    volumes:
      - mongo_data:/data/db
    ports:
      - 27017:27017
volumes:
  mongo_data:
    name: mongo_data
  • /some/path/mqtt/dockerConfig.js
module.exports = {
  protos: ['tcp', 'ws'],
  host: 'localhost',
  port: 1883,
  wsPort: 3000,
  wssPort: 4000,
  tlsPort: 8883,
  key: null,
  cert: null,
  rejectUnauthorized: true,
  credentials: null,
  brokerId: 'aedes',
  concurrency: 100,
  queueLimit: 42,
  maxClientsIdLength: 23,
  heartbeatInterval: 60000,
  connectTimeout: 30000,
  stats: false,
  statsInterval: 5000,
  mq: {
    name: 'mongodb',
    options: {
      url: 'mongodb://localhost:27017/aedes'
    }
  },
  verbose: false,
  veryVerbose: false,
  noPretty: false
}
Dominant language
JavaScript
Stars
62
Forks
19
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from moscajs/aedes-cli

All issues in moscajs/aedes-cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.