IBM Cloud Pak® for Data monitoring data is
stored in an embedded InfluxDB database. By
default, the data is retained for 30 days. You can increase the retention period to store additional
data or decrease the retention period if you need to reduce the size of the database.
Before you begin
To complete this task, you must be an administrator on the Red Hat®
OpenShift® Container Platform project where Cloud Pak for Data is deployed.
About this task
To change the retention period, you must change the settings of the embedded InfluxDB database.
Procedure
-
Log in to your Red Hat
OpenShift Container Platform cluster
as a project administrator:
oc login OpenShift_URL:port
- Change to the project where Cloud Pak for Data
is deployed:
- Get the password for the InfluxDB
service:
oc get secret -o yaml dsx-influxdb-auth
Locate the influxdb-password
entry in the response.
- Decode the password:
echo value-from-influxdb-password | base64 -d
Save the decoded password somewhere secure.
- Get the ID of an InfluxDB
pod:
oc get pods | grep influx
- Open a bash shell inside the pod:
oc exec oc exec -it dsx-influxdb-0 bash
- Determine the current data retention policy.
- Connect to InfluxDB:
- Authenticate to InfluxDB:
auth admin decoded-InfluxDB-password
- View the current retention policy:
show retention policies on WATCHDOG;
For example, the command might
return:
name duration shardGroupDuration replicaN default
---- -------- ------------------ -------- -------
autogen 1440h0m0s 24h0m0s 1 true
thirty_days 720h0m0s 24h0m0s 1 false
three_days 72h0m0s 24h0m0s 1 false
- Change the retention policy:
ALTER RETENTION POLICY thirty_days ON WATCHDOG DURATION duration REPLICATION 1
Use
InfluxDB notations to change the
duration. For example:
- To set the retention policy to 45 days, change
duration
to
45d
- To set the retention policy to 6 weeks, change
duration
to
6w
For more information about the InfluxDB
notation, see Duration units in the InfluxDB documentation.