Retention Policy not found

Hi,

I have set

   retention-autocreate = true

then I do

create database test4

use test4

settings

and get

Setting           Value
--------          --------
Host              localhost:8086
Username          
Database          test4
RetentionPolicy   
Pretty            false
Format            column
Write Consistency all
Chunked           true
Chunk Size        0

A “normal” select shows my test data

> select * from temperature
name: temperature
time                location value
----                -------- -----
1582261426792595537 A        5

The following command shows an issue

> select * from test4.temperature
ERR: retention policy not found: test4

What is wrong here? The background why I need this format is that it seems that Grafana is using this querying format. Since retention policy should get created automatically I wonder why it doesn’t show a retention policy in settings. Any help is appreciated.

What happens if you run show retention policies from the Influx CLI? You should see the autogen (default) and your own retention policy. You can switch between the two by specifying it in the cli

use yourdatabase.your_retention
then your normal query should work.

Is the “retention-autocreate” an influx config setting?

> show retention policies
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        true
> 

so there is a retention policy.

Your proposal shows this

> use test4.autogen
Using database test4
Using retention policy autogen
> select * from test4.temperature
ERR: retention policy not found: test4

Yes this setting is a standard (I have googled that setting)

[meta]
  # Where the metadata/raft database is stored
  dir = "/var/lib/influxdb/meta"

  # Automatically create a default retention policy when creating a database.
   retention-autocreate = true

My influxdb is a fresh install, all standard. At the moment I don’t want to do anything special. I just need that query to work I believe to get Grafana to access the influxdb.

Thanks.

Even if I create a RP manually I get the same error

> show retention policies
name    duration shardGroupDuration replicaN default
----    -------- ------------------ -------- -------
autogen 0s       168h0m0s           1        false
rp_1    24h0m0s  1h0m0s             1        false
rp_2    24h0m0s  1h0m0s             1        true

HI @ingoinflux

What is the name of the database you want to use? test4? If it is, then in your telegraf configuration set the output database to "test4"and set the retention policy config option to use one of the ones you’ve created (rp_2).

The agent should start sending data into influx in the database test4.rp_2

When you connect, you specify the database and RP you want. You don’t need to reflect this in your query. So, if you are using that database and rp, you would connect to the CLI and type

use test4.rp_2

Then your query of select * from temperature would work

I think, whats happening when you are trying is you’re selecting it from the database “test4” which is seen as the retention policy in the query (I’ve just tried myself, if i specify the DB name with the measurement it fails but if i specify the RP instead it works)

In fact, the query you have

select * from test4.temperature

Change this to

select * from rp_2.temperature

Do that give you different output?