prometheus thanos搭建

thanos集群介绍完毕,现在开始搭建集群。

下载地址:

wget https://github.com/thanos-io/thanos/releases/download/v0.20.1/thanos-0.20.1.linux-amd64.tar.gz

再开始搭建之前必须准备好一个桶(bucket),在minio管理页面创建一个prometheus-bucket,如图:

再在prometheus上创建 bucket_config.yaml

type: s3
config:
  bucket: prometheus-bucket
  endpoint: ***************   ###minio的地址加端口
  access_key: ***********
  secret_key: **********
  insecure: true

启动sidecar

nohup ./thanos sidecar --tsdb.path "/usr/local/thanos/data" --prometheus.url "http://localhost:9090" --http-address 0.0.0.0:19191 --grpc-address 0.0.0.0:19091 --objstore.config-file /usr/local/thanos/bucket_config.yaml --shipper.upload-compacted &

创建store目录

mkdir /usr/local/thanos/store

启动store

nohup ./thanos store --data-dir /usr/local/thanos/data --objstore.config-file bucket_config.yaml --http-address 0.0.0.0:39191 --grpc-address 0.0.0.0:39090 &

启动query

nohup ./thanos query --http-address "0.0.0.0:29090" --grpc-address "0.0.0.0:29091" --query.replica-label replica --store "172.21.231.103:19091" --store "172.21.231.104:19091" --store "172.21.231.105:19091" --store "172.21.231.103:39090" --store "172.21.231.104:39090" --store "172.21.231.105:39090" &

启动compact

nohup ./thanos compact --data-dir /usr/local/thanos/compact --http-address 0.0.0.0:19192 --objstore.config-file bucket_config.yaml &

启动ruler

nohup ./thanos rule --data-dir  "/usr/local/thanos/ruler_data" --eval-interval "30s" --rule-file  "/usr/local/prometheus/rules/*.yml" --alert.query-url "http://0.0.0.0:29090" --alertmanagers.url "http://172.21.231.103:9093" --query "172.21.231.103:29090" --query "172.21.231.104:29090" --objstore.config-file "bucket_config.yaml"  --label 'region="sz"' --label 'replica="A"' &

thanos搭建完毕

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值