Freeing Disk Space

Hello everyone,

i have create a retention policy with 2 weeks of rentention and it have deleted all the data…
Well it’s not a big issue for me, but the disk space of the database have been not decrease.

Do you know if there is a solution to “optimise” the disk space like in mysql ? Or i have backup/drop/restore databases ?

Regards,
Thomas.

Hi,

Can you share your InfluxDB configuration file? It could be that a compaction even hasn’t happened yet, which means the data hasn’t been removed from disk yet.

You can usually find this config in /etc/influxdb/influxdb.conf

Thanks

Well i can’t import a file because i’m a newbie :confused:

So i share it just like that

> Blockquote
reporting-disabled = false

[meta]
dir = “/var/opt/influxdb/meta”
hostname = “localhost”
bind-address = “:8088”
retention-autocreate = true
election-timeout = “1s”
heartbeat-timeout = “1s”
leader-lease-timeout = “500ms”
commit-timeout = “50ms”

[snapshot]

[data]
dir = “/var/opt/influxdb/data”
cache-max-memory-size = “1g”
compact-throughput = “48m”
max-concurrent-compactions = 1
wal-dir = “/var/opt/influxdb/wal”
wal-enable-logging = true
wal-compaction-threshold = 0.5

[cluster]

[retention]
enabled = true
check-interval = “30m”

[monitor]

[admin]
enabled = true
bind-address = “:8083”
https-enabled = false
https-certificate = “/etc/ssl/influxdb.pem”

[http]
enabled = true
bind-address = “:8086”
auth-enabled = false
log-enabled = false
write-tracing = false
pprof-enabled = false
https-enabled = false
https-certificate = “/etc/ssl/influxdb.pem”

[[graphite]]
enabled = false

[collectd]
enabled = false
retention-policy = “”
batch-timeout = “10s”
typesdb = “/usr/share/collectd/types.db”
auth-file = “/etc/collectd/auth_file”

[opentsdb]
enabled = false

[[udp]]
enabled = false

[continuous_queries]
log-enabled = true
enabled = true
recompute-previous-n = 2
recompute-no-older-than = “10m”
compute-runs-per-interval = 10
compute-no-more-than = “2m”

[hinted-handoff]
enabled = true
dir = “/var/opt/influxdb/hh”
max-size = 1073741824
max-age = “160h”
retry-rate-limit = 0
retry-interval = “1s”

When i search the datafiles it’s like that:

find -exec du -h {} ;

199G ./default
381M ./2 weeks
199G .
199G ./default
3,4G ./default/19
4,8G ./default/27
5,0G ./default/36
5,0G ./default/45
5,0G ./default/54
5,0G ./default/63
5,0G ./default/72
5,0G ./default/81
5,1G ./default/90
5,1G ./default/99
5,0G ./default/108
5,1G ./default/117
5,1G ./default/126
5,1G ./default/135
5,0G ./default/144
5,0G ./default/153
5,1G ./default/162
5,1G ./default/171
5,0G ./default/180
5,0G ./default/189
5,2G ./default/198
5,2G ./default/207
5,3G ./default/216
5,1G ./default/225
5,1G ./default/234
5,0G ./default/243
5,0G ./default/252
5,1G ./default/261
5,1G ./default/270
5,1G ./default/279
5,1G ./default/288
4,8G ./default/297
5,0G ./default/306
5,1G ./default/315
5,1G ./default/324
5,0G ./default/333
5,1G ./default/342
5,1G ./default/351
5,0G ./default/360
5,0G ./default/368
297M ./default/376
381M ./2 weeks
260M ./2 weeks/377
122M ./2 weeks/379

i think it’s a retention thing, or a compactor one, but i have making something like that in a previous version without any issues…

Regards.

Are you an enterprise customer?

No, it’s only a simple instance.

Thomas.

I have see a solution, with a dump/erase/restore by the entreprise solution, but i don’t have one.

OK. Just seen some enterprise options and was curious.

Regardless, the problem is one we can fix.

Unfortunately, you did create a retention policy called two weeks, but you’ve been writing data to the default retention policy; which is infinite.

You can modify the retention of your default RP to 2 weeks; I think that’s the simplest solution.

ALTER RETENTION POLICY "default" ON "database_name" DURATION 2w SHARD DURATION 1d DEFAULT

1 Like

When i created i policy i just make:
CREATE RETENTION POLICY “2 weeks” ON “telegraf” DURATION 2w REPLICATION 1 DEFAULT

That’s not right?

So, i make
“ALTER RETENTION POLICY “default” ON “telegraf” DURATION 2w SHARD DURATION 1d DEFAULT;” it doesn’t work

but
“ALTER RETENTION POLICY “default” ON “telegraf” DURATION 2w DURATION 1d DEFAULT;”
works…

That is correct, but you have many many GBs of data in your default RP. This was maybe written before you created your new RP; but you’ll need to clean this up (as per your initial request).

So you can either modify its retention period or delete data from a
influx shell

Oh, I may have misremembered the syntax. Apologies

No issue by my side, so how many times it sould take to reduce the data files ?

The most suprising thing is that’s erase all my datas… again… i have no mesuarements but the database is still 200G has it was…

Well it’s solve it works. Now the datafile is reduced to the minimum.

Retention policies delete all data that is older than your limit, so you’ll delete data whenever it’s 2 weeks old.

Sounds like you’re sorted now. Glad we got there :+1:

1 Like

it have deleted all my datas, all, the recent and the others… But well it’s not a big issue for me.