InfluxDB CLI - Begin with Influx database
Updated: 5 hours ago
In this post, I will be having walking you through Influx CLI.
We will import data from public time-stamped data. Further to that, we will see how we can query data in the database
With this post, we will get data which we can view through Grafana with the help of the next post.
To see more such post #RealTimeMonitoring
Step1 - Download time-stamped sample database
Step 2 - Import Database
Step 3 - Connect to Influx CLI
Step 4 - Perform Queries to View Data
Open a command prompt. Go to the location where you wish to download data
Download sample time-stamped data publicly available.
curl https://s3.amazonaws.com/noaa.water-database/NOAA_data.txt -o NOAA_data.txt
Note about sample data:
Give below command to import downloaded database to influxdb:
influx -import -path="c:\data_influx\NOAA_data.txt" -precision=s -database=NOAA_water_database
Make sure InfluxDB server is running
Open command prompt
Change to the location where InfluxDB directory is. Else set Influx directory in path variables
Execute below command to connect to Influx CLI:
influx -precision rfc3339
The argument "-precision rfc3339" returns timestamp in format YYYY-MM-DDTHH:MM: SS.nnnnnnnnn
To see databases:
Connect to database:
Use database <dbname>
See Measurements(You can say table if you are from SQL background)
Use select statement to view the points (each row is a point) in a measurement
Measurement is made of:
Values - Actual Data
Tags - Meta Data
Now we have data ready, let's get to our next post which talks about setting up a popular visualization tool- Grafana with the current database as the data source.