prometheus snapshot backup restore

https://groups.google.com/forum/#!topic/prometheus-users/0ZkYVj_8X8Q

 

 

First, for the snapshot when you launch prometheus, you'll need to add
--web.enable-admin-api

Then after that, you can trigger a snapshot by hitting:
curl -XPOST http://<promethues IP:Port>/api/v2/admin/tsdb/snapshot

This will respond with something like:

{"name":"2018-04-30T21:45:35Z-6e4d24be51aa32e3a"}

 

From the prometheus server, look in <value of --storage.tsdb.path>/snapshots and you'll see a dir with the name matching the response above. 

If you need to recover from snapshot, you can just stop prometheus, delete the items in the storage.tsdb.path directory, and put the contents of the snapshot directory in its place.  Or you can update the actual value of the storage.tsdb.path to point to the snapshot, but I prefer the first way.

 

The snapshot command can be ran from a cron job or similar to trigger regular cleanups.
Since it's creating hard links, space usage and time to initially create is minimal.  But if you move the files, and over time you'll see the space needs increase. 

You can just rm contents of the snapshot folder when they're no longer needed, or copy them off to a different location after the snapshot is generated  The snapshot can not just target a different location initially. 

转载于:https://www.cnblogs.com/xuchenCN/p/11528224.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值