Mosquitto 客户端无法向 EMQ X 发布消息

Mosquitto client can't publish message to EMQ X Broker

我有这样的模型:

EMQ X Broker 安装在 IP 222.x.y.z.

还有两个 Mosquitto 客户端。

我想发布来自 Mosquitto_client_2 的消息然后接收 Mosquitto_client_1。

我喜欢这样:

第 1 步:运行 命令:

mosquitto_sub -h 222.x.y.z -t "TEST_TEST"

于 Client_1

第二步:EMQ X Broker 自动创建主题"TEST_TEST",像这样

第 3 步:Mosquitto 客户端 2 发布消息,运行 命令:

mosquitto_pub -h 222.x.y.z -t TEST_TEST -m "hello world"

但是它有这样的问题 "Error: Connection refused":

我不知道错误的原因以及如何修复此错误。

P/s: 我也为 EMQ X 打开了所有端口。

首先排除网络问题,使用telnet判断端口是否可以访问

telnet localhost 1883

Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.