thanos实现prometheus高可用部署

最近公司需要新建监控平台,本文做thanos的prometheus高可用实验,实现如下图
在这里插入图片描述

1.thanos sidecar实现

  • systemctl命令启动
vi /etc/systemd/system/thanos_sidecar.service

[Unit]
Description=Thanos SideCar
After=network.target

[Service]
Type=simple
User=root
ExecStart=/root/prometheus/thanos/thanos sidecar --prometheus.url=http://192.168.56.102:9090 --tsdb.path=/var/lib/prometheus/ --objstore.config-file=/root/prometheus/thanos/conf/bucket_config.yaml
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动

systemctl start thanos_sidecar
systemctl enable thanos_sidecar
systemctl status thanos_sidecar
  • nohup命令启动
nohup /root/prometheus/thanos/thanos sidecar --prometheus.url=http://192.168.56.102:9090 \
--tsdb.path=/var/lib/prometheus/ \
--objstore.config-file=/root/prometheus/thanos/conf/bucket_config.yaml \
>> sidecar.log 2>&1 &

2.query实现

  • systemctl命令实现
vi /etc/systemd/system/thanos_query.service

[Unit]
Description=Thanos Query
After=network.target

[Service]
Type=simple
User=root
ExecStart=/root/prometheus/thanos/thanos query --http-address 0.0.0.0:19095 --grpc-address 0.0.0.0:19096 --store 127.0.0.1:10901 
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动

systemctl start thanos_query
systemctl status thanos_query
systemctl enable thanos_query
  • nohup命令实现
nohup /root/prometheus/thanos/thanos query --http-address 0.0.0.0:19095 --grpc-address 0.0.0.0:19096 \
--store 127.0.0.1:10901 >> thanos_query.log 2>&1 &

3.Store Gateway实现

vi /etc/systemd/system/thanos_store.service

[Unit]
Description=Thanos Store Gateway
After=network.target

[Service]
Type=simple
User=root
ExecStart=/root/prometheus/thanos/thanos store --data-dir=/root/prometheus/thanos/store --objstore.config-file=/root/prometheus/thanos/conf/bucket_config.yaml --grpc-address 0.0.0.0:19093 --http-address 0.0.0.0:19094 
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动

systemctl start thanos_store
systemctl status thanos_store
systemctl enable thanos_store

4.Compact实现

vi /etc/systemd/system/thanos_compact.service

[Unit]
Description=Thanos Compact
After=network.target

[Service]
Type=simple
User=root
ExecStart=/root/prometheus/thanos/thanos compact --data-dir=/root/prometheus/thanos/compact --objstore.config-file=/root/prometheus/thanos/conf/bucket_config.yaml --http-address 0.0.0.0:19097 --wait 
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动

systemctl start thanos_compact
systemctl status thanos_compact
systemctl enable thanos_compact
  • nohup方式
nohup ./thanos compact --data-dir=./compact \
    --objstore.config-file=/root/prometheus/thanos/conf/bucket_config.yaml \
    --http-address 0.0.0.0:19097 \
    --wait >> thanos_compact.log 2>&1 &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值