当前位置:网站首页>使用prom-label-proxy实现Prometheus Thanos的基于标签的多租户读
使用prom-label-proxy实现Prometheus Thanos的基于标签的多租户读
2022-04-23 06:01:00 【洒满阳光的午后】
本文档的前提是已有一个安装好的Thanos集群。
组件安装
Go安装:
Download and install - go.dev (google.cn)
prom-label-proxy安装:
go env -w GOPROXY=https://goproxy.cn
go get github.com/prometheus-community/prom-label-proxy
# 使用go env命令查看GOPATH,编译好的可执行文件在GOPATH的bin目录下
cd ~/go/bin
./prom-label-proxy --help
Caddy安装
yum install yum-plugin-copr
yum copr enable @caddy/caddy
yum install caddy
组件配置
假设Prometheus拥有如下external_labels(使用已有标签区分租户或者单独添加租户tenant标签均可):
# 租户OrgA prometheus.yml
global:
external_labels:
region: eu-west
tenant="OrgA"
replica: 0
# 租户OrgB prometheus.yml
global:
external_labels:
region: eu-east
tenant="OrgB"
replica: 0
启动prom-label-proxy:
nohup ./prom-label-proxy -label tenant -upstream http://<thanos_query_ip>:<thanos_query_port> -insecure-listen-address 0.0.0.0:8080 &
label参数的含义为所有发送给后端thanos query的请求url必须携带tenant=abc参数,否则会报错。
配置并启动caddy:
# vi /etc/caddy/Caddyfile
:8081 {
rewrite * ?{query}&tenant=OrgA
reverse_proxy localhost:8080
}
:8082 {
rewrite * ?{query}&tenant=OrgB
reverse_proxy localhost:8080
}
# 启动caddy
systemctl start caddy
其中8081端口提供给租户OrgA,8082端口提供给租户OrgB,即可保证每个租户只能查询到自身数据。
Grafana配置:
为Grafana中不同的Org添加各自的数据源(填写caddy地址)即可。
读路径结构
版权声明
本文为[洒满阳光的午后]所创,转载请带上原文链接,感谢
https://zhangrongjie.blog.csdn.net/article/details/121491696
边栏推荐
- volatile 关键字的三大特点【数据可见性、指令禁止重排性、不保证操作原子性】
- rdma 编程详解
- openvswitch vlan网络实践
- MySQL Server单机部署手册
- mysql密码过期的方法
- Curry realization of function continuous call calculation and accumulation
- ES入门学习笔记
- Centos8 builds php8 0.3 operating environment
- 【Lombok快速入门】
- 阅读笔记:Meta Matrix Factorization for Federated Rating Predictions
猜你喜欢
随机推荐
Oracle Net Service:监听器与服务名解析方法
页面缓存问题解决方法(慎用)
异常记录-14
file_get_contents 访问 ssl 错误的两种解决方法
[no steps in a small step to a thousand miles] Oracle Application derivative ora-01455 error reporting processing
异常记录-6
【MySQL基础篇】数据导出导入权限与local_infile参数
ebfp编程常用API介绍
Number of stair climbing methods of leetcode
Implementation of leetcode question brushing str ()
LeetCode刷题|13罗马数字转整数
CentOS8搭建PHP8.0.3运行环境
2021年国产数据库12强介绍
JS implementation of web page rotation map
Basic concepts of database: OLTP / OLAP / HTAP, RPO / RTO, MPP
Ansible basic commands, roles, built-in variables and tests judgment
Working principle and practice of browser
Introduction to the top 12 domestic databases in 2021
A website that directly downloads PNG icons without logging in
TP5 uses redis