Raspberry Pi上的Mosquitto

时间:2016-10-30 21:22:56

标签: raspberry-pi mqtt

我坚持在Raspberry Pi上安装Mosquitto - 我安装了它:

aptitude install mosquitto mosquitto-clients python-mosquitto libmodule-pluggable-perl

这是我的配置:

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/
log_timestamp true 
password_file /etc/mosquitto/passwd


listener 1883 127.0.0.1 
listener 8883


log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d 

日志显示该服务已启动&运行:

* mosquitto.service - LSB: mosquitto MQTT v3.1 message broker    Loaded: loaded (/etc/init.d/mosquitto)    Active: active (exited) since So 2016-10-30 22:20:56 CET; 10s ago   
Process: 2065 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)   
Process: 2071 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)

Okt 30 22:20:56 elfriede mosquitto[2071]: Starting network daemon:: mosquitto. 
Okt 30 22:20:56 elfriede systemd[1]: Started LSB: mosquitto MQTT v3.1 message broker.

netstat -an | grep 1883什么也没显示,端口没有收听。任何提示?出了什么问题?

1 个答案:

答案 0 :(得分:-2)

如果netstat -an| grep 1883没有显示任何内容,则mosquitto可能无法运行,因为1883被配置为mosquitto代理配置文件的监听器。 请检查运行ps aux|grep mosquitto的mosquitto进程是否正确,以便确认mosquitto是否正在运行。 尝试sudo service mosquitto status也检查蚊子的服务状态。

最好运行killall -9 mosquitto以杀死蚊子进程。

如果没有运行,你可以执行mosquitto -c /etc/mosquitto/mosuitto.conf来运行mosquitto。这里可以使用配置文件的路径。您可以通过mosquitto -c /etc/mosquitto/mosuitto.conf -d

将mosquitto作为守护进程运行