Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: monitoring_servers数据保留时间怎么调整
Add the following to the monitoring_servers configuration:
storage_retention: 2b
Found that it has no effect, the monitoring data is still increasing.
Run ps -ef | grep prometheus
to check if the Prometheus process includes the --storage.tsdb.retention
option and see how many days this option is set to.
If you want to retain it for 2 days, it should be 2d, right?
I made a mistake and wrote “d” as “b”.
When will the data trigger recycling?
Did the parameters set not take effect after restarting Prometheus?
Restarted Prometheus with --storage.tsdb.retention=2d, but the storage space has not been reclaimed. Now the storage space usage has reached 95%, so I want to know when the reclamation will be triggered.
I experimented myself and found that setting -storage.tsdb.retention takes effect immediately. There might be two reasons why it doesn’t work on your side:
- The parameter was not set successfully. Go directly to the Prometheus server and execute
ps -ef | grep prometheus
to check if --storage.tsdb.retention is set correctly.
- Most of your storage space is occupied by data from the last 2 days, so setting --storage.tsdb.retention=2d won’t make a difference. Check the directory where Prometheus monitoring data is stored and see when the earliest data directory was created.
I set it to retain for one day
ps -ef|grep prometheus
tidb 22701 1 4 Jul15 ? 03:04:46 bin/prometheus/prometheus --config.file=/sdata/usr/local/tidb/monitoring_servers1/conf/prometheus.yml --web.listen-address=:9091 --web.external-url=http://172.18.3.251:9091/ --web.enable-admin-api --log.level=info --storage.tsdb.path=/sdata/data/tidb/monitoring_servers1 –storage.tsdb.retention=1d
Directory with large monitoring data storage: docdb
In the picture you showed, those are not Prometheus data files, but Pump data files. Did you enter the wrong directory? Check if Prometheus data files and Pump data files are placed on the same file system.
The data retention time for Prometheus should be adjustable. “storage.tsdb.retention.time=10000d”
This topic will be automatically closed 60 days after the last reply. No new replies are allowed.