Mqtt nodes not connecting

I'm running node-red in a cloud server. All mqtt nodes show a yellow "connecting" label, but they never achieve the connection. How can I find the problem?

Find where your mqqt broker is, then compare this with your NR config

The mqtt broker is in the same cloud server
Plus I get a message in the console, from node-red: [info] [mqtt-broker:5e25a454.56e434] Connection failed to broker: node-red@mqtt://localhost:1883
Don't know what to compare

You've not really told us anything about the environment so we can't really help.

Sorry, I'm trying to set up an iot platform, so I got a cloud server, using ubuntu 18.04 with apache server, a db, a mosquitto mqtt server and node-red. I built a node red flow with several input and output to mqtt, and it puts a tag every 15 seconds, that is when it gives the [info] message above.
Node-red is v1.2.6, , node.js is v8.10.0
The connection to the db seems fine, but with the mqtt broker doesn't
Any other thing that can help?

Verify connection to mqtt broker with some other tool/client

  • are you sure mqtt broker is running and listening?
  • port, ip, userid+pw, tls???
  • show your flow/config of mqtt connection

1610380939: Socket error on client , disconnecting.
1610380954: New connection from on port 1883.
1610380954: Sending CONNACK to (0, 5)
This is mosquitto log
And the flow:

Can you show a bit more of the log please.

Also please export the three mqtt nodes and paste them here, using the </> button at the top of the forum entry window when pasting it in.

What version of Mosquitto broker are you using ?

Are you using authorization as @krambriw asked ?

According to this post on Github (0,5) is related to authorization.

This is the full log, it keeps repeating every 15'

mosquitto is v1.4.15

Im not an expert with MQTT but that version is since 2018 .. is it possible to update to a more recent version ? :wink:

This is one of the mqtt nodes

So have you configured the mqtt broker correctly to accept the user login???

And this is the full mosquitto answer:
1610386283: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting
1610386283: Using default config.
1610386283: Opening ipv4 listen socket on port 1883.
1610386283: Error: Address already in use

So you have already one instance of the broker running on port 1883. Put here a copy of what you get when you run the command ps aux

First step before even thinking of NR, have you tried to use the mosquitto client to publish and subscribe and see if that works?

root 20266 0.0 0.0 14864 1072 pts/1 S+ 18:00 0:00 grep --color=auto mosquitto
mosquit+ 23892 0.0 0.2 48152 4104 ? S 2020 8:16 mosquitto -c /etc/mosquitto/conf.d/broker.conf -v