EMQX使用端口
TCP端口:1883
SSL端口:8883
WS端口:8083
WSS端口:8084
管理平台端口:18083
修改
前提是已经搭建好了一套EMQX服务,如果要搭建另一套需要将使用的端口全部进行修改
端口配置:更改/emqx/etc/emqx.conf文件,内容如下:
node {
name = "emqx1@127.0.0.1"
cookie = "emqx1secretcookie"
data_dir = "data"
}
cluster {
name = emqxcl
discovery_strategy = manual
}
dashboard {
listeners.http {
bind = 38082
}
}
listeners.tcp.default {
bind = "0.0.0.0:9884"
max_connections = infinity
}
listeners.ssl.default {
bind = "0.0.0.0:38883"
enabled = true
acceptors = 16
enable_authn = true
max_connections = infinity
mountpoint = ""
proxy_protocol = false
proxy_protocol_timeout = 3s
}
listeners.ws.default {
bind = "0.0.0.0:38083"
enabled = true
enable_authn = true
max_connections = infinity
proxy_protocol = false
proxy_protocol_timeout = 3s
mountpoint = ""
}
listeners.wss.default {
bind = "0.0.0.0:38084"
enabled = true
enable_authn = true
max_connections = infinity
proxy_protocol = false
proxy_protocol_timeout = 3s
mountpoint = ""
}
注意事项
node.name一定要做修改,并且还要包含数字
node.name一定要做修改,并且还要包含数字
node.name一定要做修改,并且还要包含数字
原因:https://www.emqx.io/docs/zh/v5.0/deploy/cluster/security.html#%E9%9B%86%E7%BE%A4%E5%86%85%E9%80%9A%E4%BF%A1%E7%AB%AF%E5%8F%A3
EMQX使用了分布式端口4370,而且端口是无法直接修改的,但可以修改node.name来修改端口
例如:在 emqx.conf 中的 node.name = emqx@192.168.0.12 应该使 节点的监听端口为 4370,而 emqx1(或 emqx-1)的端口为 4371,以此类推
如果node.name不包含数字,上述内容不会生效