May-28th-2019, 02:10 PM
Influx Data Time Series DB - InfluxDB
Installing InfluxDB on Windows
Installing InfluxDB on Windows
- Download InfluxDB runtime on the downloads page
Open the link and cklick on the v1.*.* InfluxDB download button.
In my case i use the following folder as my root directory: "c:\Program Files\InfluxDB"
- Extract the downloaded ZIP file
There are no installers, all what you need is inside the ZIP file.
Create a folder called "executables" and extract the downloaded "influx.1.*.*_windows_amd64.zip" Zfile into the folder.
- Configure Influx DB
We need to edit the "influxdb.conf" before we can execute InfluxDB.
Create a folder called "data".
This folder contains all the data that needs to be backed up. It will make upgading and backups easier.
Change the META dir
Open the file "influxdb.conf" and locate the tag "[meta]".
Chage the "meta" directory:
[ meta ] # Where the metadata/raft database is storeddir = "C:/Program Files/InfluxDB/data/meta" - Change the DATA + WAL dir
Locate the tag "[data]" and change the directories:
[data] # The directory where the TSM storage engine stores TSM files. dir = "C:/Program Files/InfluxDB/data/data"...wal-dir = "C:/Program Files/InfluxDB/data/wal" - Enable HTTP endpoint
Locate the tag "[data]" and change the directories:
[http]# Determines whether HTTP endpoint is enabled. enabled = true - First run - Test the configuration
Run the "influxd.exe" from the installation directory.
If there are no errors in the started console, you can call a browser and navigate to "http://localhost:8086/query".
All is fine, if the broser shows this message:
"{"error":"missing required parameter \"q\""}"
Now the InfluxDB is running on your Windows PC.
Here is an example Node-RED flow to create a database, delete, write value and read a value (consider to adapt the ip address settings to your local setup).
Code:
[{"id":"e1c52c5c.35463","type":"influxdb in","z":"107486a2.b32cb9","influxdb":"e68b7284.a1c8e","name":"CREATE DATABASE \"MyTest\"","query":"CREATE DATABASE MyTest","rawOutput":false,"precision":"","retentionPolicy":"","x":470,"y":600,"wires":[["e684ccca.27276"]]},{"id":"28c1de74.db3b62","type":"inject","z":"107486a2.b32cb9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":600,"wires":[["e1c52c5c.35463"]]},{"id":"e684ccca.27276","type":"debug","z":"107486a2.b32cb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":600,"wires":[]},{"id":"87f33759.13b298","type":"influxdb in","z":"107486a2.b32cb9","influxdb":"e68b7284.a1c8e","name":"DROP DATABASE \"MyTest\"","query":"DROP DATABASE MyTest","rawOutput":false,"precision":"","retentionPolicy":"","x":460,"y":700,"wires":[["ebc6df4c.c19d8"]]},{"id":"ebc6df4c.c19d8","type":"debug","z":"107486a2.b32cb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":700,"wires":[]},{"id":"65e4d10d.7aaf4","type":"influxdb in","z":"107486a2.b32cb9","influxdb":"e68b7284.a1c8e","name":"READ DATABASE","query":"SELECT value FROM myValue WHERE time > now() - 1h limit 1000;","rawOutput":false,"precision":"","retentionPolicy":"","x":430,"y":980,"wires":[["28aaeafe.920e76"]]},{"id":"28aaeafe.920e76","type":"debug","z":"107486a2.b32cb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":980,"wires":[]},{"id":"3427ec2d.332094","type":"inject","z":"107486a2.b32cb9","name":"trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":700,"wires":[["87f33759.13b298"]]},{"id":"dfae07c1.b5a168","type":"inject","z":"107486a2.b32cb9","name":"write 0","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":800,"wires":[["71893c52.24f9f4"]]},{"id":"bcf61aaf.421348","type":"inject","z":"107486a2.b32cb9","name":"read from database","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":980,"wires":[["65e4d10d.7aaf4"]]},{"id":"6c43917c.d18bb","type":"comment","z":"107486a2.b32cb9","name":"Create a database","info":"","x":190,"y":560,"wires":[]},{"id":"e3d1d544.7e2388","type":"comment","z":"107486a2.b32cb9","name":"Delete a database","info":"","x":190,"y":660,"wires":[]},{"id":"b8e862e1.14967","type":"comment","z":"107486a2.b32cb9","name":"Write a value","info":"","x":170,"y":760,"wires":[]},{"id":"5795be2a.21b6d","type":"inject","z":"107486a2.b32cb9","name":"write 50","topic":"","payload":"50","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":840,"wires":[["71893c52.24f9f4"]]},{"id":"77ba500f.3c23b","type":"inject","z":"107486a2.b32cb9","name":"write 99","topic":"","payload":"99","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":170,"y":880,"wires":[["71893c52.24f9f4"]]},{"id":"594532ee.6fec6c","type":"comment","z":"107486a2.b32cb9","name":"Read from database (return last 5 min)","info":"","x":250,"y":940,"wires":[]},{"id":"71893c52.24f9f4","type":"influxdb out","z":"107486a2.b32cb9","influxdb":"e68b7284.a1c8e","name":"Write value","measurement":"myValue","precision":"","retentionPolicy":"","x":410,"y":840,"wires":[]},{"id":"e68b7284.a1c8e","type":"influxdb","z":"","hostname":"10.11.5.52","port":"8086","protocol":"http","database":"MyTest","name":"","usetls":false,"tls":""}]