当前位置: 首页 > 知识库问答 >
问题:

Mosquitto作为MQTT转发代理

章宏恺
2023-03-14

重新启动时,Mosquitto不可靠地转发排队消息(持久化不起作用)

运行蚊子版本:1.4.15

这是最后测试的配置:

port 1883
persistence true
persistence_file /mosquitto.db
persistence_location /etc/mosquitto

autosave_interval 1
autosave_on_changes true

allow_anonymous true

connection iotcluster
address ip:1883

notifications false
keepalive_interval 300
restart_timeout 30
start_type automatic

clientid rabbitmqtt
username user
password password

topic mqtt out 2
try_private true
mosquitto_pub -h localhost -p 1883 -t mqtt -m "Test-Bridge-Online"

共有1个答案

龚德本
2023-03-14

在运行了mosquitto版本1.6.10的更新后,仍然没有成功。

我可以分离出主要的问题--数据库在seetings时没有保存:

persistence true
persistence_file /mosquitto.db
persistence_location /etc/mosquitto

autosave_interval 1
autosave_on_changes true

不确定原因,但无法通过上述设置调用数据库保存。

persistence true
persistence_file /mosquitto.db
persistence_location /etc/mosquitto

autosave_interval 300
autosave_on_changes false
# publish a new message
mosquitto_pub -h localhost -p 1883 -t mqtt -m "Test Offline 100" -q 1
# send signal to save database
killall -SIGUSR1 mosquitto
user mosquitto
port 1883

allow_anonymous true
queue_qos0_messages true

persistence true
persistence_file mosquitto.db
persistence_location /etc/mosquitto/
autosave_interval 300
autosave_on_changes false

connection ConName
address remote-ip:1883
bridge_protocol_version mqttv31
clientid ClientName
username user
password password
cleansession false
try_private false
retain_available false

start_type automatic
restart_timeout 60
keepalive_interval 120

notifications true
notifications_local_only true
notification_topic mqtt

topic mqtt out 1
 类似资料: