由于我在 Ubuntu 16.04 上更新了 Mosquitto v2.0.3,用户无法连接到代理。
\n当我尝试运行/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf它时,抛出以下消息。\n2020-12-22|12:37:02: Error: Unable to write pid file.
我看到有人有同样的问题,所以我添加了pid_file /var/run/mosquitto/mosquitto.pid 了 mosquitto 配置,但问题并没有消失。
我有这个/lib/systemd/system/mosquitto.service:
[Unit]\nDescription=Mosquitto MQTT Broker\nDocumentation=man:mosquitto.conf(5) man:mosquitto(8)\nAfter=network.target\nWants=network.target\n\n[Service]\nType=notify\nNotifyAccess=main\nExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf\nExecReload=/bin/kill -HUP $MAINPID\nRestart=on-failure\nExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto\nExecStartPre=/bin/chown mosquitto: /var/log/mosquitto\nExecStartPre=/bin/mkdir -m 740 -p /var/run/mosquitto\nExecStartPre=/bin/chown mosquitto: /var/run/mosquitto\n\n[Install]\nWantedBy=multi-user.target\nRun Code Online (Sandbox Code Playgroud)\nmosquitto.conf 文件配置为:
\n# Place your local configuration in /etc/mosquitto/conf.d/\n#\n# A full description of the configuration file is at\n# /usr/share/doc/mosquitto/examples/mosquitto.conf.example\n\npid_file /var/run/mosquitto/mosquitto.pid\n\npersistence true\npersistence_location /var/lib/mosquitto/\n\nlog_dest file /var/log/mosquitto/mosquitto.log\n\ninclude_dir /etc/mosquitto/conf.d\n\nlistener 1883\n\nlog_type error\nlog_type …Run Code Online (Sandbox Code Playgroud)