Installation

EMQX binary packages are released on below operating systems:

  • CentOS 7 (EL7)
  • CentOS 8 (EL8)
  • Raspbian 10
  • Debian 9
  • Debian 10
  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04
  • macOS 10
  • Windows Server 2019

Package Installation (Linux)

  1. Download EMQX package emqx.comInstallation - 图1 (opens new window) or GithubInstallation - 图2 (opens new window)

  2. Install EMQX Broker:

    • RPM package:

      1. $ sudo yum install emqx-cenots7-v4.0.0.x86_64.rpm
    • DEB package:

      1. # for ubuntu/debian
      2. $ sudo apt install ./emqx-ubuntu18.04-v4.0.0_amd64.deb
      3. $ sudo apt install ./emqx-debian10-v4.0.0_amd64.deb
  3. Start EMQX Broker

    • quick start

      1. $ emqx start
      2. emqx 4.0.0 is started successfully!
      3. $ emqx_ctl status
      4. Node 'emqx@127.0.0.1' is started
      5. emqx v4.0.0 is running
    • systemctl

      1. $ sudo systemctl start emqx
    • start as service

      1. $ sudo service emqx start
  4. Stop EMQX Broker

    1. $ emqx stop
    2. ok
  5. Uninstall EMQX Broker

    • DEB:

      1. $ sudo apt remove --purge emqx
    • RPM:

      1. $ sudo yum remove emqx

ZIP (Linux、MacOS、Windows)

WARING

ZIP packages are released for quick testing and hot-beam upgrade. Do NOT install zip packages for production unless you know how to manually resolve all the runtime dependencies.

  1. Download EMQX zip package from emqx.comInstallation - 图3 (opens new window) or GithubInstallation - 图4 (opens new window).

  2. Unzip the installation file:

    1. $ unzip emqx-ubuntu18.04-v4.0.0.zip
  3. Start EMQX Broker

    1. $ ./bin/emqx start
    2. emqx 4.0.0 is started successfully!
    3. $ ./bin/emqx_ctl status
    4. Node 'emqx@127.0.0.1' is started
    5. emqx v4.0.0 is running
  4. Stop EMQX Broker

    1. $ ./bin/emqx stop
    2. ok
  5. Remove EMQX Broker

    Simply delete the EMQX Broker directory

Running EMQX in Docker (Contain a simple docker-compose cluster)

Run a single container

  1. Get docker image

  2. Start docker container

    1. $ docker run -d --name emqx -p 1883:1883 -p 8081:8081 -p 8083:8083 -p 8883:8883 -p 8084:8084 -p 18083:18083 emqx/emqx:v4.0.0

Create a simple static cluster by docker-compose

  1. Create docker-compose.yaml file

    1. version: '3'
    2. services:
    3. emqx1:
    4. image: emqx/emqx:v4.0.0
    5. environment:
    6. - "EMQX_NAME=emqx"
    7. - "EMQX_HOST=node1.emqx.io"
    8. - "EMQX_CLUSTER__DISCOVERY=static"
    9. - "EMQX_CLUSTER__STATIC__SEEDS=emqx@node1.emqx.io, emqx@node2.emqx.io"
    10. - "EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s"
    11. - "EMQX_MQTT__MAX_TOPIC_ALIAS=10"
    12. volumes:
    13. - ./tmp/emqx.lic:/opt/emqx/etc/emqx.lic
    14. healthcheck:
    15. test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
    16. interval: 5s
    17. timeout: 25s
    18. retries: 5
    19. networks:
    20. emqx-bridge:
    21. aliases:
    22. - node1.emqx.io
    23. emqx2:
    24. image: emqx/emqx:v4.0.0
    25. environment:
    26. - "EMQX_NAME=emqx"
    27. - "EMQX_HOST=node2.emqx.io"
    28. - "EMQX_CLUSTER__DISCOVERY=static"
    29. - "EMQX_CLUSTER__STATIC__SEEDS=emqx@node1.emqx.io, emqx@node2.emqx.io"
    30. - "EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s"
    31. - "EMQX_MQTT__MAX_TOPIC_ALIAS=10"
    32. volumes:
    33. - ./tmp/emqx.lic:/opt/emqx/etc/emqx.lic
    34. healthcheck:
    35. test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
    36. interval: 5s
    37. timeout: 25s
    38. retries: 5
    39. networks:
    40. emqx-bridge:
    41. aliases:
    42. - node2.emqx.io
    43. client:
    44. image: python:3.7.2-alpine3.9
    45. depends_on:
    46. - emqx1
    47. - emqx2
    48. tty: true
    49. networks:
    50. emqx-bridge:
    51. networks:
    52. emqx-bridge:
    53. driver: bridge
  2. Start docker-compose cluster

    1. $ docker-compose -p my_emqx up -d
  3. View cluster

    1. $ docker exec -it my_emqx_emqx1_1 sh -c "emqx_ctl cluster status"
    2. Cluster status: #{running_nodes => ['emqx@node1.emqx.io','emqx@node2.emqx.io'],
    3. stopped_nodes => []}

For more information about EMQX Broker Docker, please visit Docker HubInstallation - 图6 (opens new window) or GithubInstallation - 图7 (opens new window)

Install and cluster via Helm (K8S、K3S)

  1. Add helm repository
  1. $ helm repo add emqx https://repos.emqx.io/charts
  2. $ helm repo update
  1. Query EMQX Broker
  1. helm search repo emqx
  2. NAME CHART VERSION APP VERSION DESCRIPTION
  3. emqx/emqx v4.0.0 v4.0.0 A Helm chart for EMQX
  4. emqx/emqx-ee v4.0.0 v4.0.0 A Helm chart for EMQX
  5. emqx/kuiper 0.1.1 0.1.1 A lightweight IoT edge analytic software
  1. Start EMQX Broker cluster
  1. $ helm install my-emqx emqx/emqx
  1. View EMQX Broker cluster situation
  1. $ kubectl get pods
  2. NAME READY STATUS RESTARTS AGE
  3. my-emqx-0 1/1 Running 0 56s
  4. my-emqx-1 1/1 Running 0 40s
  5. my-emqx-2 1/1 Running 0 21s
  6. $ kubectl exec -it my-emqx-0 -- emqx_ctl cluster status
  7. Cluster status: #{running_nodes =>
  8. ['my-emqx@my-emqx-0.my-emqx-headless.default.svc.cluster.local',
  9. 'my-emqx@my-emqx-1.my-emqx-headless.default.svc.cluster.local',
  10. 'my-emqx@my-emqx-2.my-emqx-headless.default.svc.cluster.local'],
  11. stopped_nodes => []}

Source code compilation and installation

  1. Get the source code
  1. $ git clone https://github.com/emqx/emqx.git
  1. Checkout to latest tag
  1. $ cd emqx
  2. $ git checkout $(git describe --abbrev=0 --tags)
  1. Compile
  1. $ make
  1. Start EMQX Broker
  1. $ cd _build/emqx/rel/emqx
  2. $ ./bin/emqx start
  3. EMQX Broker 4.3-beta.1 is started successfully!
  4. $ ./bin/emqx_ctl status
  5. Node 'emqx@127.0.0.1' is started
  6. emqx 4.3-beta.1 is running