top of page

LearningMilestone by Anuradha Agarwal is a one-stop place for coding classes for kids and workshops for teachers and parents and self-paced courses, a blog for everyone to learn python programming with a personalized approach by an experienced instructor with a decade of experience in the software industry.

  • Writer's pictureAnuradha Agarwal

InfluxDB CLI - Begin with Influx database

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


MILESTONE STEPS


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:

Show Databases
  • Connect to database:

Use database <dbname>
  • See Measurements(You can say table if you are from SQL background)

show measurements

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

  • Timestamp

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.


 





3,723 views0 comments

Recent Posts

See All
bottom of page