Git Product home page Git Product logo

Comments (5)

L-607 avatar L-607 commented on June 30, 2024 1

you can do it just like this

version: '3'

services:
  emqx1:
    image: emqx/emqx:4.4.10
    container_name: emqx_node1
    restart: always
    environment:
    - "EMQX_NAME=emqx"
    - "EMQX_HOST=node1.emqx.io"
    - "EMQX_CLUSTER__DISCOVERY=static"
    - "[email protected],[email protected],[email protected]"
    healthcheck:
      test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
      interval: 5s
      timeout: 25s
      retries: 5

    networks:
      emqx-bridge:
        ipv4_address: '10.0.0.2'
        aliases:
        - node1.emqx.io

  emqx2:
    image: emqx/emqx:4.4.10
    container_name: emqx_node2
    restart: always
    environment:
    - "EMQX_NAME=emqx"
    - "EMQX_HOST=node2.emqx.io"
    - "EMQX_CLUSTER__DISCOVERY=static"
    - "[email protected],[email protected],[email protected]"
    healthcheck:
      test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
      interval: 5s
      timeout: 25s
      retries: 5
    networks:
      emqx-bridge:
        ipv4_address: '10.0.0.3'
        aliases:
        - node2.emqx.io

  emqx3:
    image: emqx/emqx:4.4.10
    container_name: emqx_node3
    restart: always
    environment:
    - "EMQX_NAME=emqx"
    - "EMQX_HOST=node3.emqx.io"
    - "EMQX_CLUSTER__DISCOVERY=static"
    - "[email protected],[email protected],[email protected]"
    healthcheck:
      test: ["CMD", "/opt/emqx/bin/emqx_ctl", "status"]
      interval: 5s
      timeout: 25s
      retries: 5
    networks:
      emqx-bridge:
        ipv4_address: '10.0.0.4'
        aliases:
        - node3.emqx.io


  haproxy:
    image: haproxy:2.4
    container_name: emqx_haproxy
    restart: always
    ports:
      - 18083:18083
      - 1883:1883
      - 8083:8083

     
    volumes:
      - ./haproxy.cfg:/haproxy.cfg
    command: ["haproxy", "-f", "/haproxy.cfg"]

    networks:
      emqx-bridge:
        ipv4_address: '10.0.0.5'
        aliases:
        - haproxy.emqx.io      

networks:
  emqx-bridge:
    driver: bridge
    ipam:
      config:
        - subnet: 10.0.0.0/24

haproxy.cfg

global
    log stdout format raw daemon debug
    nbproc 1
    nbthread 2
    cpu-map auto:1/1-2 0-1
   
defaults
    log global
    mode tcp
    option tcplog
    maxconn 1024000
    timeout connect 30000
    timeout client 600s
    timeout server 600s

frontend emqx_tcp
   mode tcp
   option tcplog
   bind *:1883
   default_backend emqx_tcp_back

backend emqx_tcp_back
    mode tcp

    server emqx1 node1.emqx.io:1883 
    server emqx2 node2.emqx.io:1883 
    server emqx3 node3.emqx.io:1883 

frontend frontend_emqx_dashboard
    bind *:18083
    option tcplog
    mode tcp
    default_backend backend_emqx_dashboard

backend backend_emqx_dashboard
    mode tcp
    balance roundrobin
    server emqx1 node1.emqx.io:18083 
    server emqx2 node2.emqx.io:18083 
    server emqx3 node3.emqx.io:18083





frontend frontend_emqx_ws
    bind *:8083
    option tcplog
    mode tcp
    default_backend backend_emqx_ws

backend backend_emqx_ws
    mode tcp
    
    balance roundrobin
    server emqx1 node1.emqx.io:8083 
    server emqx2 node2.emqx.io:8083 
    server emqx3 node3.emqx.io:8083 

from emqtt-bench.

L-607 avatar L-607 commented on June 30, 2024 1

may be docker network set problem,run this command

docker network ls

then you will see an doggy_emqx-bridge docker network,you need rm this

docker network rm doggy_emqx-bridge 

At last

docker-compose up -d

from emqtt-bench.

jumpingliu avatar jumpingliu commented on June 30, 2024

@607qwq
Thanks but I encounter this error after applying your update for docker-compose.yml and haproxy.cfg.
Trying to look up by docker logs <container ID> but nothing show up.

image

from emqtt-bench.

jumpingliu avatar jumpingliu commented on June 30, 2024

Thanks it works!
May I ask whatpub_overrunmeans?
image

and meanwhile sub
image

It does receive the message but why pub_overrun?
Thanks:)

from emqtt-bench.

jumpingliu avatar jumpingliu commented on June 30, 2024

@607qwq problem solved, thanks

from emqtt-bench.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.