Error with curl

Hey I am pretty new to InfluxDb and I have some trouble when creating a databas via curl in the Influx Shell.

Can somebody help?

Hi @Sol_Invictus, Welcome !

Curl is not used within the influx shell ,
Here is a curl example to create a database Create database

Hope this helps …

Ps you can also create a database with the influx commandline

Hey Marc thanks for your answer!

I need the curl command because I want ro write Data Points from a file into Influx.

Is the Http API something different than the Influx Shell? How can I acess it?

Thank you

Hi ,

to create a database with curl , you can start curl from the command prompt :

curl -i -XPOST http://localhost:8086/query --data-urlencode “q=CREATE DATABASE mydbfromcurl”

and to go to the influx shell (cli ) you can type influx to enter the shell
and type your commands in the shell ,

or for example : influx -execute “show databases”

you can write datapoints from a file to the database as follows :

curl -i -XPOST ‘http://localhost:8086/write?db=Mydb’ --data-binary @cpu_data.txt

but it is better explained in the link I posted :slight_smile:

Hi Mark,

Thanks for your Help! I figured it out.
Now I am trying to curl this sample dataset into Influx, but it doesnt recognise the dataset.

Here is the dataset:
Thanks again for your help.

Hi ,

that dataset is 4 years old and contains json formatted data :slight_smile: ,
do you want to upload json formatted data ?

Writing points from a file

Write points from a file by passing @filename to curl . The data in the file should follow InfluxDB’s line protocol syntax.

Example of a properly-formatted file ( cpu_data.txt ):

cpu_load_short,host=server02 value=0.67
cpu_load_short,host=server02,region=us-west value=0.55 1422568543702900257
cpu_load_short,direction=in,host=server01,region=us-west value=2.0 1422568543702900257

Write the data in cpu_data.txt to the mydb database with:
curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary @cpu_data.txt


Actually its not important.
I just want to write a big dataset into influx.
Do you maybe have a better dataset I can write into Influx?

sure here it is :slight_smile:sample data

How can I Download the Data there ?
I just see graphs when I click on a station in a state.

Hi , yes ,

The data is here :

Hey thanks got it.

Now I am follwing the instructions on this site:
And I get a error message when I use the command:

influx -import -path=NOAA_data.txt -precision=s -database=mydb

It says that it expects something like “CREATE” or “SHOW” after the Influx command.
Do you know what the Problem could be?