Introduction
As InfluxDB is an open-source time series database (TSDB), it is designed so that it is easy to store and access information. A good database is crucial to any company or organization. This is because the database stores all the pertinent details about what the company wants to store, like salaries, transactional records or any valuable information.
In this post, we will continue this post Go >>> and we will learn how to send data to the database, only installing an InfluxDB node on Node-RED.
Related Links
Node-red-contrib-influxdb
Now, we are going to open Node-RED >>> and install node-red-contrib-influxdb nodes from InfluxDB.
1. So, go to the Menu > Manage Palette > Install > Type: node-red-contrib-influxdb and click on Install.
2. Then, go to the nodes sections, filter your search by influx, and drop an Influx out node to the flow.
3. Then configure your Influx out node with a server, organisation, bucket and measurement. We did it like this:
[{"id":"0e17644c4b3628b4","type":"influxdb out","z":"b716fdc48724e610","influxdb":"bc4ab5cb2a050021","name":"","measurement":"test","precision":"","retentionPolicy":"","database":"","retentionPolicyV18Flux":"","org":"Industrial Shields","bucket":"test","x":340,"y":100,"wires":[]},{"id":"bc4ab5cb2a050021","type":"influxdb","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"test","usetls":true,"tls":"d50d0c9f.31e858","influxdbVersion":"2.0","url":"http://localhost:8086","rejectUnauthorized":false,"credentials":{}},{"id":"d50d0c9f.31e858","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":false}]
Note: In order to import this json file, go to Node-RED > Menu > Import > Paste this JSON file, and click on Import.
4. Finally, add an inject node with a number to run this example.
Get data form InfluxDB
Now, deploy your application and click on the button from the inject node to send the data to the database.
So, let's see what we got in the database now!
As you can see, we have stored the information in InfluxDB! But, what if the information would not come from an inject node, but from MQTT data?
Want to learn how?
II. InfluxDB & Node-RED & MQTT Tutorial: Sending data to InfluxDB