Firewall configurations, disable firewalld for quick in this example, you might want add ports through firewall.

systemctl stop firewalld
systemctl disable firewalld

Then make nodes know each other

vim /etc/hosts link1 link2

The emqx.conf is config of emqx, content(default ) is huge and you can copy it from flollowing site:

emqx/emqx.conf at main-v4.3 · emqx/emqx
An Open-Source, Cloud-Native, Distributed MQTT Message Broker for IoT. - emqx/emqx.conf at main-v4.3 · emqx/emqx

Or you can copy it with docker:

docker run -d --name emqx --rm emqx/emqx
docker cp emqx:/opt/emqx/etc .
docker rm -f emqx

Then start emqx container on each node(change the highlight line according to you nodes):

docker run -tid --name emqx --restart=always --network host \
    -e EMQX_NAME=link1 \
    -e EMQX_HOST= \
    -e EMQX_WAIT_TIME=30 \
    -e EMQX_JOIN_CLUSTER="link1@" \
    -e EMQX_CLUSTER__NAME=emqxcl \
    -e EMQX_CLUSTER__STATIC__SEEDS="link1@,link2@" \

Check running status

docker logs -f emqx
cluster.discovery = "static" = "emqxcl"
cluster.static.seeds = "link1@,link2@"
listener.ssl.external.acceptors = "32"
listener.ssl.external.max_connections = "102400"
listener.tcp.external = "1883"
listener.tcp.external.acceptors = "64"
listener.tcp.external.max_connections = "1024000" = "16" = "102400"
listener.wss.external.acceptors = "16"
listener.wss.external.max_connections = "102400" = "console"
node.max_ets_tables = "2097152"
node.max_ports = "1048576" = "link1@"
node.process_limit = "2097152"
rpc.port_discovery = "manual"
Starting emqx on node link1@
Start http:management listener on 8081 successfully.
Start http:dashboard listener on 18083 successfully.
Start mqtt:tcp:internal listener on successfully.
Start mqtt:tcp:external listener on successfully.
Start mqtt:ws:external listener on successfully.
Start mqtt:ssl:external listener on successfully.
Start mqtt:wss:external listener on successfully.
EMQ X Broker 4.3.8 is running now!

Check cluster status via

docker exec -it emqx /bin/sh /opt/emqx/bin/emqx_ctl cluster status
Cluster status: #{running_nodes =>
                  stopped_nodes => []}

Open webbrowser, access site
user: admin
password: public