I have been learning node red for the past days and I wanted to start working with MQTT. For this I installed Mosquito on my Mac and created an MQTT broker. I know it works since I can play with it in the terminal using mosquitto_pub and mosquitto_sub, but when I try to connect to the broker using bordered it cannot connect.
I use the localhost:1883 (I checked and this is the port where my broker is)
Can anyone help me please? anything can help, I have read that I need to edit the conf file from mosquitto but I don't know how to do that either.
In the mqtt nodes, you need to define the location of the broker. If you install the broker on device A (let's say it's IP address is 192.168.1.50) and NR is installed on device B (let's say it's IP address is 192.168.1.75), in the MQTT configuration you need to enter 192.168.1.50 as the server address
If your network knows about the device names you can use the device name in the server entry like mqttpizw.local (this is a pi zero w that I'm running mosquitto on)
I got the IP for the container and it still didn't work... also, if I try to connect with Mqtt explorer, I use localhost and it works just fine, I don't understand
The two docker containers have their own IP address. To connect from one docker container to another docker container, you need to use the IP address of the second container. Also, as mosquito V2 is more secure by default, you need to edit the conf file to permit external connections other than localhost.
This would have been good to have told people at the start
We need to see the startup commands for the two containers to see which ports have been mapped to external ports on the host.
It would be a good idea to install Portainer (you can run that as a container as well) as this will give you much more visibility as to what the containers are doing and let you access their runtime parameters etc