1

Is there a way to store all received messages into a TimescaleDB in VerneMQ?

Is there any existing plugin or a service which I could use?

Anshul Walia
  • 547
  • 1
  • 5
  • 9

4 Answers4

1

I'm not familiar with VerneMQ, but a quick google suggests it should have existing integrations with PostgreSQL (https://vernemq.com/blog/2015/08/05/vernemq-says-hi-to-postgresql.html).

TimescaleDB is built as an extension to PostgreSQL, and speaks via standard PostgreSQL connectors. So start by just trying any existing PostgreSQL connectors/integrations.

Mike Freedman
  • 1,692
  • 9
  • 9
1

First, I would generalize the question a bit. For the described use case it would be the same as "Writing MQTT data to PostgreSQL".

You would need to subscribe to VerneMQ topics using any MQTT compatible client and then write this data into the PostgreSQL database (TimescaleDB completely relies on PostgreSQL for this purpose).

Option 1: Write your own service that will read MQTT topics (use MQTT client library like Eclipse Paho) and then write data to PostgreSQL.

Option 2: use Telegraf (https://docs.timescale.com/timescaledb/latest/tutorials/telegraf-output-plugin/#before-we-start). The only issue with Telegraf - the version with PostgreSQL support only available as a fork and quite outdated (1.13).

Option 3: use Node-RED. They have built-in plugins to read MQTT data and a plugin to write to PostgreSQL (this one works: https://flows.nodered.org/node/node-red-contrib-re-postgres)

1

If you are looking for a manufacturing specific solution you can take a look at "mqtt-to-postgresql" from the United Manufacturing Hub.

The microservices takes data from VerneMQ and writes them (load balanced and performance oriented) into a TimescaleDB.

If you searching for something more general you can build it yourself and copy some code from the above project.

0

You need a custom plugin for this. The company behind VerneMQ or other partners can help you with consulting for writing custom plugins. Alternatively, you could use VerneMQ webhooks to send the data to a webhook that will write to TimescaleDB, though this will not be the more efficient/scalable approach to take.

codeadict
  • 2,643
  • 1
  • 15
  • 11