prometheus快照:

启动prometheus服务时加--web.enable-admin-api

/space/prometheus/prometheus --config.file=/space/prometheus/prometheus.yml --storage.tsdb.path=/space/prometheus/data --web.enable-admin-api

制作快照:

curl -XPOST http://localhost:9090/api/v2/admin/tsdb/snapshot

会在/space/prometheus/data/生成snapshots目录,里面是以日期开头的子目录,可将该目录剪切到其它备份路径

恢复快照:

将prometheus服务关闭,/space/prometheus/data目录改名,然后将snapshots下日期开头的目录改名为data,再开启prometheus服务即可