
About this task
The data retention policy for InfluxDB defaults to infinite, i.e. data is never deleted. As a result, Spark and Hadoop
Grafana dashboards may take longer to load and InfluxDB may take up more space than necessary. To reduce
the amount of space being used by InfluxDB, the data retention policy for each database needs to be reduced, as
described in this procedure. Reducing the data retention policy for Spark and Hadoop databases can reduce the
load time of the Spark and Hadoop Grafana dashboards.
Procedure
1. Log on to login2 and become root.
2. Switch to the
/var/lib/influxdb/data
directory.
#
cd /var/lib/influxdb/data
3. Use the
du
command to show how much space being used.
The sizes below are shown as examples. Actual sizes on the system may vary.
$
du -sh *
14G Cray Urika GX
1.5G CrayUrikaGXHadoop
906M CrayUrikaGXSpark
21M _internal
#
4. Connect to InfluxDB to view the current data retention policy.
#
/bin/influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB
server management, and monitoring.
Connected to http://localhost:8086 version 0.12.2
InfluxDB shell 0.12.2
> show retention policies on "Cray Urika GX"
name duration shardGroupDuration replicaN default
default 0 168h0m0s 1 true
5. Update the data retention policy according to requirements.
In this example the data retention duration is changed from 0 (forever) to 2 weeks (504 hours).
> alter retention policy default on "Cray Urika GX" Duration 2w
> show retention policies on "Cray Urika GX"
name duration shardGroupDuration replicaN default
default 504h0m0s 24h0m0s 1 true
> exit
The change will take a while to be applied. The default is 30 minutes.
6. Verify that the data retention change has taken effect
#
du -sh *
3G Cray Urika GX
1.5G CrayUrikaGXHadoop
906M CrayUrikaGXSpark
21M _internal
System Monitoring
S3016
92