docker部署emqx服务

前言

EMQ X 是一个开源的分布式 MQTT 消息传递代理,它可以支持多达 100 万级的并发 MQTT 连接。它可用于连接到支持 MQTT 协议的任何设备,也可用于将消息从服务器端传递到客户端

部署


  • 不需要持久化数据,创建的topic随时会被消耗掉,即不需要考虑备份、恢复数据的顾虑,部署好服务即可
]# echo 'Asia/Shanghai' > /etc/timezone
]# mkdir -p /data/deploy/emqx/
]# cd /data/deploy/emqx/
emqx]# cat > docker-compose.yml <<-EOF
version: "3.5"
services:
  emqx:
    image: emqx/emqx:4.3.7
    container_name: emqx
    hostname: emqx 
    ports:
      - 1883:1883
      - 8081:8081
      - 8083:8083
      - 8084:8084
      - 8883:8883
      - 18083:18083
    environment:
      - "EMQX_NAME=emqx"
      - "EMQX_HOST=127.0.0.1"
      - "EMQX_RETAINER__STORAGE_TYPE=disc"
      - "EMQX_CLUSTER__DISCOVERY=static"
      - "[email protected]"
      - "EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s"
      - "EMQX_MQTT__MAX_TOPIC_ALIAS=10"
    healthcheck:
      test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
      interval: 5s
      timeout: 25s
      retries: 5        
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
      - /data/volume/emqx/log:/opt/emqx/log:Z      
    restart: always
    tty: true  
EOF
emqx] docker-compose up -d

emqx的健康检查

]# docker exec -it emqx sh -c "emqx_ctl cluster status"
Cluster status: #{running_nodes => ['[email protected]'],stopped_nodes => []}
  • emqx web ui
    url username password
    http://10.0.2.10:18083 admin public

结语

emqx 官网
emqx install
emqx cluster knowledge
参考部署
Docker hub emqx
emqx dashboard
mqtt knowledge

你可能感兴趣的:(docker,linux,ubuntu,docker,容器)