prometheus高可用配置

方案一

Thanos

https://github.com/improbable-eng/thanos

部署要求:

prometheus v2.2.1 版本以上

go 1.10 以上版本

用户对象存储的数据库

安装thanos:

go get -v -d github.com/improbable-eng/thanos/.. 
cd ${GOPATH}/src/github.com/improbable-eng/thanos
make

Sidecars

thanos通过sidecar进程把多个prometheus实例整合起来。sidecar部署在和prometheus同台机器上或同个pod.

sidecar要求aprometheus版本在2.0以上。

sidecar负责备份数据到对象存储,并且查询prometheus实例。

启动

thanos sidecar \
    --prometheus.url    http://localhost:9090 \     # Prometheus's HTTP address
    --tsdb.path         /var/prometheus \           # Data directory of Prometheus
    --gcs.bucket        example-bucket \            # Bucket to upload data to

如果不想备份任何数据,在启动时去掉 --gcs.bucket 选项。

目前已经支持的两种存储:Google Cloud Storage, AWS S3

需要使用其他存储需要重写:https://github.com/improbable-eng/thanos/blob/master/pkg/objstore/objstore.go

查询

thanos各个组件之间通过高性能的grpc api进行交互。

thanos sidecar \
    --prometheus.url            http://localhost:9090 \
    --tsdb.path                 /var/prometheus \
    --gcs.bucket                example-bucket \
    --grpc-address              0.0.0.0:19091 \            # gRPC endpoint for Store API (will be used to perform PromQL queries)
    --http-address              0.0.0.0:19191 \            # HTTP endpoint for collecting metrics on Thanos sidecar
    --cluster.address           0.0.0.0:19391 \            # Endpoint used to meta data about the current node
    --cluster.advertise-address 127.0.0.1:19391 \          # Location at which the node advertise itself at to other members of the cluster
    --cluster.peers             127.0.0.1:19391 \          # Static cluster peer where the node will get info about the cluster

Query Layer

支持查询PromQL在多个prometheus实例。内部通过可容错的最终一致协议gossip实现。支持扩容和自动发现。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值