mosquitto mysql,有没有一种方法可以将Mosquitto有效载荷存储到MySQL数据库中以进行历史记录?...

本文探讨了如何使用 Mosquitto MQTT 代理将发布的消息存储到 MySQL 数据库,无需创建客户端或订阅通配符主题。提到 Mosquitto-auth-plugin 的用途并非消息内容存储,并提供了几种方法实现,如Java应用、Node-RED 流程和HiveMQ broker。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I am using Mosquitto MQTT broker and I would like to store every published message into a MySQL database without creating a client and subscribing to # wildcard.

I found this https://github.com/jpmens/mosquitto-auth-plug but my english is not good enough to understand it thoroughly... I think it is only to store persistent message for the broker to resend them later. Am I right ?

Thanks

解决方案

The mosquitto-auth-plugin uses the database to store username/password and ACL information, not message content.

Writing some code to store messages in a database from any MQTT broker is relatively simple.

There are several approaches:

You could write a small java/python/nodejs application to do it using one of the MQTT libraries for a given language.

You could use something like Node-RED to create a flow that will write messages to the database.

You could use the HiveMQ broker instead of Mosquitto which has a plugin mechanism that supports storing messages in a database.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值