蚊子出版问题?
Mosquitto publishing issue?
我在 Ubuntu 16.04 服务器上安装了 Mosquitto 和 运行。
我在 2 个单元 phone 上使用 Owntracks 并让他们订阅对方的主题。
然后上周的某个时候 phone 都失去了对方的话题,紧接着 phone 2 就日志而言没有连接到 MQTT 但 phone 仍然报告已连接。
然后今天我使用 webhooks 在端口 8083 上添加了一个新的侦听器。我能够连接到 Web 管理界面并订阅 phone 1 的主题。
我使用 CLI 进行了订阅,以查看是否可以通过 Web 界面与 phone 2 的用户一起发布以进行一些故障排除。当我断开连接并尝试重新连接(与 phone 2 和 phone 1 个用户)时,我无法重新连接到 MQTT。
我重新启动了 MQTT,并且能够重新建立连接,但是现在当我发布任何内容时,订阅者中什么也没有出现。 Phone 1 不再显示,即使 CLI 也无法正常发布。
我假设我的配置有问题。
mosquitto.conf
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
persistence_file mosquitto.db
log_dest file /var/log/mosquitto/mosquitto.log
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
password_file /etc/mosquitto/pwfile
acl_file /etc/mosquitto/aclfile.acl
#Internal Listener
listener 1883
allow_anonymous false
#External Listener
#listener 8883
#allow_anonymous false
#certfile /etc/letsencrypt/live/home.fqdn.com/cert.pem
#cafile /etc/letsencrypt/live/home.fqdn.com/chain.pem
#keyfile /etc/letsencrypt/live/home.fqdn.com/privkey.pem
#Webhooks Listener
listener 8083
protocol websockets
certfile /etc/letsencrypt/live/home.fqdn.com/cert.pem
cafile /etc/letsencrypt/live/home.fqdn.com/chain.pem
keyfile /etc/letsencrypt/live/home.fqdn.com/privkey.pem
aclfile.acl
# This affects access control for clients with no username.
topic read $SYS/#
# This only affects clients with username "phone1".
topic owntracks/phone1/phone-1
topic read owntracks/phone2/phone-2
# This only affects clients with username "phone2".
topic owntracks/phone2/phone-2
topic read owntracks/phone1/phone-1
# This affects all clients.
pattern write $SYS/broker/connection/%c/state
在每个 topic
/pattern
块之前应该有一个 user
条目来说明他们适用于哪个用户:
# This affects access control for clients with no username.
topic read $SYS/#
# This only affects clients with username "phone1".
user phone1
topic owntracks/phone1/phone-1
topic read owntracks/phone2/phone-2
# This only affects clients with username "phone2".
user phone2
topic owntracks/phone2/phone-2
topic read owntracks/phone1/phone-1
# This affects all clients.
pattern write $SYS/broker/connection/%c/state
我在 Ubuntu 16.04 服务器上安装了 Mosquitto 和 运行。 我在 2 个单元 phone 上使用 Owntracks 并让他们订阅对方的主题。
然后上周的某个时候 phone 都失去了对方的话题,紧接着 phone 2 就日志而言没有连接到 MQTT 但 phone 仍然报告已连接。
然后今天我使用 webhooks 在端口 8083 上添加了一个新的侦听器。我能够连接到 Web 管理界面并订阅 phone 1 的主题。
我使用 CLI 进行了订阅,以查看是否可以通过 Web 界面与 phone 2 的用户一起发布以进行一些故障排除。当我断开连接并尝试重新连接(与 phone 2 和 phone 1 个用户)时,我无法重新连接到 MQTT。
我重新启动了 MQTT,并且能够重新建立连接,但是现在当我发布任何内容时,订阅者中什么也没有出现。 Phone 1 不再显示,即使 CLI 也无法正常发布。
我假设我的配置有问题。
mosquitto.conf
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
persistence_file mosquitto.db
log_dest file /var/log/mosquitto/mosquitto.log
log_type error
log_type warning
log_type notice
log_type information
connection_messages true
log_timestamp true
password_file /etc/mosquitto/pwfile
acl_file /etc/mosquitto/aclfile.acl
#Internal Listener
listener 1883
allow_anonymous false
#External Listener
#listener 8883
#allow_anonymous false
#certfile /etc/letsencrypt/live/home.fqdn.com/cert.pem
#cafile /etc/letsencrypt/live/home.fqdn.com/chain.pem
#keyfile /etc/letsencrypt/live/home.fqdn.com/privkey.pem
#Webhooks Listener
listener 8083
protocol websockets
certfile /etc/letsencrypt/live/home.fqdn.com/cert.pem
cafile /etc/letsencrypt/live/home.fqdn.com/chain.pem
keyfile /etc/letsencrypt/live/home.fqdn.com/privkey.pem
aclfile.acl
# This affects access control for clients with no username.
topic read $SYS/#
# This only affects clients with username "phone1".
topic owntracks/phone1/phone-1
topic read owntracks/phone2/phone-2
# This only affects clients with username "phone2".
topic owntracks/phone2/phone-2
topic read owntracks/phone1/phone-1
# This affects all clients.
pattern write $SYS/broker/connection/%c/state
在每个 topic
/pattern
块之前应该有一个 user
条目来说明他们适用于哪个用户:
# This affects access control for clients with no username.
topic read $SYS/#
# This only affects clients with username "phone1".
user phone1
topic owntracks/phone1/phone-1
topic read owntracks/phone2/phone-2
# This only affects clients with username "phone2".
user phone2
topic owntracks/phone2/phone-2
topic read owntracks/phone1/phone-1
# This affects all clients.
pattern write $SYS/broker/connection/%c/state