天天看點

Prometheus斷電後啟動異常 Error on ingesting samples that are too old or are too far into the future

國慶假期回來後,發現

Prometheus

服務啟動後沒資料,檢視日志

level=warn ts=2020-10-09T02:29:06.700Z caller=scrape.go:1216 component="scrape manager" scrape_pool=service.server target=http://192.168.1.22:9100/metrics msg="Error on ingesting samples that are too old or are too far into the future" num_dropped=929
level=warn ts=2020-10-09T02:29:06.700Z caller=scrape.go:987 component="scrape manager" scrape_pool=service.server target=http://192.168.1.22:9100/metrics msg="appending scrape report failed" err="out of bounds"
           

日志的時間戳與目前時間戳提前了8個小時:

level=warn ts=2020-10-09T02:29:06.700Z

可能是國慶伺服器長時間斷電導緻的

tsdb

記錄日期太舊。

解決方法:

prometheus 版本:2.16.0
作業系統:CentOS 7.6
           
# 建立一個新的 tsdb 資料目錄
mkdir /root/prometheus-2.16.0/tsdb_data/

# 啟動時指定 tsdb 資料目錄為剛剛建立的
/root/prometheus-2.16.0/prometheus \
--config.file="/root/prometheus-2.16.0/prometheus.yml" \
--storage.tsdb.path="/root/prometheus-2.16.0/tsdb_data" \
--web.enable-lifecycle \
--web.enable-admin-api &
           

繼續閱讀