Fail To Connect To External MQTT Broker

Hi,

I’m currently using ChirpStack v4 and trying to configure it to connect to an external MQTT broker, but I’m encountering issues. The MQTT connection fails with the following error when running journalctl -u chirpstack -f:

ERROR chirpstack::integration::mqtt: MQTT error error=I/O: connection closed by peer

Here is the relevant portion of my chirpstack.toml configuration:

[integration]
enabled = ["mqtt"]

[integration.mqtt]
json = true
server = "tcp://<my_broker>:1883/"
username = "my_username"
password = "my_password"
topic_prefix = "my_topic_prefix"
client_id = ""

I have verified that the broker is reachable and that the credentials are correct by testing with mosquitto_sub. However, ChirpStack still fails to maintain a connection.

Could you please help me identify what might be wrong with the configuration or suggest further troubleshooting steps?
Thanks

1 Like

I’m Facing the same exact issue, and having been trying to understand the issue for several days now with no progress.

We are running Ubuntu 24 LTS VM on top of Proxmox, and when we install Chirpstack and Mosquitto on the SAME server, everything works, BUT, once we seperated Chirpstack from its other dependencies (ie Mosquitto, Redis, and Postgresql) these errors went rampant in two flavors:
ERROR chirpstack::gateway::backend::mqtt: MQTT error error=I/O: Connection refused (os error 111)

Brocarr, Can you help us understand what’s going on?

Did you configure the backend setting in your regional file? That is the actual MQTT backend for chirpstack, whereas the post above is referencing the mqtt integration

Dear Liam,

Thank you very much. It works Now. To better understand, what is the difference between the two errors above:
1 - chirpstack::integration::mqtt:
2- chirpstack::gateway::backend::mqtt:

Thanks,

Backend vs Integration.

The backend is where Chirpstack receives it’s data. It’s the MQTT broker that gateways should post their encrypted messages to such that Chirpstack can receive them, decrypt them, and use them.

The integration is where Chirpstack forwards data out. It’s the MQTT broker that Chirpstack posts the decrypted version of the events to after it receives the events from the backend. It is meant to be used to integrate other platforms with Chirpstack, as they require the unencrypted uplinks.