物理环境部署prometheus +thanos-sidecar
公司内网环境,一些私有云和网络设备的监控在一台物理机部署了prometheus,现在用thanos做prometheus的持久化存储,所以要部署一套物理环境跟上一个文章中的prometheus-operator 中的 thanos 对应
修改prometheus的配置文件添加一个label
global:
scrape_interval: 60s
evaluation_interval: 60s
external_labels:
prometheus: monitoring/gcp
prometheus_replica: prometheus-gcp-0复制
修改prometheus启动文件
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/
After=network.target
[Service]
Type=simple
User=prometheus
ExecStart=/opt/prometheus-2.13.1/bin/prometheus --config.file=/opt/prometheus-2.13.1/cfg/prometheus.yml --storage.tsdb.path=/opt/prometheus-2.13.1/data --web.enable-lifecycle --web.enable-admin-api --storage.tsdb.min-block-duration=2h --storage.tsdb.max-block-duration=2h
Restart=on-failure
[Install]
WantedBy=multi-user.target复制
下载thanos文件
wget https://github.com/thanos-io/thanos/releases/download/v0.12.2/thanos-0.12.2.linux-amd64.tar.gz
tar -zxvf thanos-0.12.2.linux-amd64.tar.gz -C /opt
ln -s /opt/thanos-0.12.2.linux-amd64/thanos /usr/local/bin/thanos复制
thanos 启动命令
/opt/thanos-0.12.2.linux-amd64/thanos sidecar --prometheus.url=http://localhost:9090 --http-address="0.0.0.0:10902" --grpc-address="0.0.0.0:10901" --tsdb.path=/opt/thanos-0.12.2.linux-amd64/data --objstore.config-file=cfg/thanos-config.yaml
复制
在k8s 的query 中添加 物理节点的ip
apiVersion: apps/v1
kind: Deployment
metadata:
name: thanos-query
namespace: monitoring
labels:
app: thanos-query
spec:
replicas: 1
selector:
matchLabels:
app: thanos-query
template:
metadata:
labels:
app: thanos-query
spec:
containers:
- name: thanos-query
image: quay.io/thanos/thanos:v0.11.0
args:
- query
- --log.level=debug
- --query.replica-label=prometheus_replica
- --query.replica-label=thanos_ruler_replica
- --store=dnssrv+thanos-store:10901
- --store=dnssrv+thanos-store-sidecar:10901
- --store=10.10.0.4:10901 # 新加的物理节点
ports:
- name: http
containerPort: 10902
- name: grpc
containerPort: 10901复制
去thanos query 页面中查看store
发现可以查看到物理节点
物理节点添加结束
文章转载自耶喝运维,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
2025年4月中国数据库流行度排行榜:OB高分复登顶,崖山稳驭撼十强
墨天轮编辑部
2547次阅读
2025-04-09 15:33:27
数据库国产化替代深化:DBA的机遇与挑战
代晓磊
1186次阅读
2025-04-27 16:53:22
2025年3月国产数据库中标情况一览:TDSQL大单622万、GaussDB大单581万……
通讯员
862次阅读
2025-04-10 15:35:48
2025年4月国产数据库中标情况一览:4个千万元级项目,GaussDB与OceanBase大放异彩!
通讯员
679次阅读
2025-04-30 15:24:06
数据库,没有关税却有壁垒
多明戈教你玩狼人杀
583次阅读
2025-04-11 09:38:42
天津市政府数据库框采结果公布,7家数据库产品入选!
通讯员
569次阅读
2025-04-10 12:32:35
国产数据库需要扩大场景覆盖面才能在竞争中更有优势
白鳝的洞穴
547次阅读
2025-04-14 09:40:20
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
487次阅读
2025-04-17 17:02:24
一页概览:Oracle GoldenGate
甲骨文云技术
464次阅读
2025-04-30 12:17:56
GoldenDB数据库v7.2焕新发布,助力全行业数据库平滑替代
GoldenDB分布式数据库
457次阅读
2025-04-30 12:17:50