当前位置:网站首页>使用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
边栏推荐
- Installing redis using a small leather panel in the window environment
- JS handwriting compatibility event binding
- [Lombok quick start]
- Will restarting the Oracle listener break the existing connection
- MySQL【sql性能分析+sql调优】
- Unix期末考试总结--针对直系
- DDOS攻击/防御介绍
- Leak detection and vacancy filling (III)
- redis 实践笔记和源码分析
- virtio 与vhost_net介绍
猜你喜欢
MySQL索引【数据结构+索引创建原则】
Installing redis using a small leather panel in the window environment
Prometheus Cortex多租户读写的实现
memcached 源码分析
MySQL 【读写锁+表锁+行锁+MVCC】
关于 synchronized、ThreadLocal、线程池、Atomic 原子类的 JUC 面试题
LeetCode刷题|897递增顺序搜索树
ovs与ovs+dpdk架构分析
Number of stair climbing methods of leetcode
基于DPDK实现VPC和IDC间互联互通的高性能网关
随机推荐
Working principle and practice of browser
Centos8 builds php8 0.3 operating environment
LeetCode刷题|两个链表的第一个公共节点
LeetCode刷题|368最大整除子集(动态规划)
surprise库中evaluate函数弃用解决方法
Concurrent optimization request
rdam 原理解析
[shell script exercise] batch add the newly added disks to the specified VG
TP5 使用redis
2021年国产数据库12强介绍
[MySQL basics] startup options and configuration files
【MySQL基础篇】启动选项、系统变量、状态变量
【代码解析(6)】Communication-Efficient Learning of Deep Networks from Decentralized Data
Set and map
重启Oracle监听器会中断已有连接吗
The arithmetic square root of X in leetcode
[ES6 quick start]
Common views of Oracle database performance analysis
AttributeError: ‘dict‘ object has no attribute ‘iteritems‘
使用百度智能云人脸检测接口实现照片质量检测