How to run mosquitto in parallel to node-red outside "local" mode?

Hi,
I am running Node-Red successfully on a raspberry pi and now I want to run mosquitto the same way on this pi to have a MQTT Broker.
I tried several explanations (they are all more or less the same), but when I start the broker I get this error message:

image

and the only device that is allowed to connect to the broker is the raspberry itself.
I edited the conf-file as described here, but with no success:

What am I doing wrong ?
BR

Normally after installing mosquitto on a Pi, it gets installed as a system service so no need to manually start it

Can you just check if this is case by re-booting the Pi and then doing

ps -aux | grep mosquitto
and see if you get similar to this which shows it running

pi@pi128gb:~/.nrmqtt $ ps -aux | grep mosquitto
mosquit+   489  0.0  0.3  12232  3540 ?        Ss   Oct19   3:48 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
pi       12186  1.0  0.0   7452   568 pts/2    S+   15:19   0:00 grep --color=auto mosquitto
pi@pi128gb:~/.nrmqtt $

Did you configure mosquitto for anonymous access or require a user name and password?

What changes have you made to /etc/mosquitto/mosquitto.conf?

Have you restarted mosquitto?

The tutorial is misleading in this area. When you run mosquitto -v I think it does not use the config file you editted. Instead you should run it as a service by running
sudo systemctl start mosquitto
Then run
systemctl status mosquitto
to check it is running ok.
Also I suggest including this in the config file, otherwise the timestamps in the log are not readable.

# human readable timestamps in log
log_timestamp true
log_timestamp_format %Y-%m-%d %H:%M:%S

Then if you look in the mosquitto log using
sudo cat /var/log/mosquitto/mosquitto.log
you should see everything that is going on.

Ah ok, I see
I was always starting the service with

mosquitto -v

to do the R&D activities in node-red, but never did the final service startup procedures.
Thanks a lot, I will try this immediately after I return home.

for anonymous access and I restarted it several times but as Colin mentioned below I never started the mosquitto as a service

Ok, unfortunately no success

The service is running fine, even after restarting the Raspi:

This is how the CONF looks like:

But the MQTT explorer is unable to connect (although the raspberry itself CAN connect to the broker)

Run
sudo tail -f /var/log/mosquitto/mosquitto.log
then in another terminal window
sudo systemctl restart mosquitto
Attempt to connect with MQTTExplorer, and post the log outputs from the mosquitto starting message.

I did that, but unfortunately the output does not explain much.

In green you can see when I restart the service
In red you can see when I try to connect with MQTT Explorer from my Laptop

In MQTT explorer did you intentionally select Encryption? De-select Encryption and try again.

yes ... exactly this was the problem :slight_smile:
Thanks a lot, everything works fine now :heart_eyes:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.