RREE
January 21, 2018, 12:41pm
1
I try a simplified example mentioned in the documentation.
$ cat pir.txt
# DDL
CREATE DATABASE pirates
CREATE RETENTION POLICY oneday ON pirates DURATION 1d REPLICATION 1
# DML
treasures value=801 1516537138
treasures value=29 1516537137
treasures value=38 1516537139
and then
$ influx -import -path=pir.txt -precision=s
I get
2018/01/21 13:37:33 error writing batch: {"error":"database is required"}
2018/01/21 13:37:33 treasures value=801 1516537138
treasures value=29 1516537137
treasures value=38 1516537139
ERROR: 3 points were not inserted
Deleting the database first doesn’t help
$ influx
Connected to http://localhost:8086 version 1.4.2
InfluxDB shell version: 1.4.2
> drop database pirates
> exit
Any help appreciated
RREE
hello @RREE !
Did you have a look at this? InfluxDB CLI/Shell | InfluxData Documentation Archive
As you can see you need a file lile this
# DDL
CREATE DATABASE pirates
CREATE RETENTION POLICY oneday ON pirates DURATION 1d REPLICATION 1
# DML
# CONTEXT-DATABASE: pirates
# CONTEXT-RETENTION-POLICY: oneday
treasures value=801 1516537138
treasures value=29 1516537137
treasures value=38 1516537139
To select the right database and rp. But using the file that I copied you will get this error back:
error writing batch: {"error":"partial write: points beyond retention policy dropped=3"}
Because all the 3 points that you are inserting are older that the retention policy (oneday). To have a working example you can use the autogen
retention policy because by default it’s forever.
# DDL
CREATE DATABASE pirates
# DML
# CONTEXT-DATABASE: pirates
# CONTEXT-RETENTION-POLICY: autogen
treasures value=801 1516537138
treasures value=29 1516537137
treasures value=38 1516537139