当前位置:网站首页>"Write multi tenant" implementation of Prometheus and thanos receiver
"Write multi tenant" implementation of Prometheus and thanos receiver
2022-04-23 07:04:00 【A sunny afternoon】
Thanos Receiver So called “ multi-tenancy ”, It is mainly reflected in the allocation of different services to different tenants Receiver( Restricted energy direction Receiver Source of sending data ), And create different instances locally for different tenants TSDB.
Thanos Receiver Component reception Prometheus Of remote_write request , Write data locally TSDB, And regularly will TSDB block Upload to object store .Receiver The components are also exposed Store API to Querer Component to realize real-time query of indicators .
Thanos Receiver Multi tenant support , It is from remote_write Requested HTTP header( Through parameters --receive.tenant-header="THANOS-TENANT" Set up ) Get the tenant's id, Each tenant has an independent TSDB, Data submitted to the tenant successfully TSDB, I.e. on behalf of remote_write The request is successful . Indicators will be tagged tenant_id( Through parameters -receive.tenant-label-name="tenant_id" Set up ) To identify the tenant of the indicator .
Prometheus It can be configured in remote_write Attach... To the request header:
remote_write:
- url: http://tenants:19291/api/v1/receive
headers:
THANOS-TENANT: a
If you want to achieve multiple Receiver Load balancing and data replication , You need to use the configuration file ( adopt --receive.hashrings-file=<path> Parameter assignment ) Will be multiple Receiver Form hash ring , The instance configuration file is as follows :
[
{
"hashring": "tenant-a",
"endpoints": ["tenant-a-1.metrics.local:19291/api/v1/receive", "tenant-a-2.metrics.local:19291/api/v1/receive"],
"tenants": ["tenant-a"]
},
{
"hashring": "tenants-b-c",
"endpoints": ["tenant-b-c-1.metrics.local:19291/api/v1/receive", "tenant-b-c-2.metrics.local:19291/api/v1/receive"],
"tenants": ["tenant-b", "tenant-c"]
},
{
"hashring": "soft-tenants",
"endpoints": ["http://soft-tenants-1.metrics.local:19291/api/v1/receive"]
}
]
The above configuration file means :THANOS-TENANT The value is a Write request for , Will be made by tenant-a-1.metrics.local:19291/api/v1/receive"、"tenant-a-2.metrics.local:19291/api/v1/receive" Two Receiver Handle ,THANOS-TENANT The value is b or c Write request for , Will be made by tenant-b-c-1.metrics.local:19291/api/v1/receive"、"tenant-b-c-2.metrics.local:19291/api/v1/receive Two Receiver Handle , No, THANOS-TENANT header Or its value is not a、b、c One of the write requests , By http://soft-tenants-1.metrics.local:19291/api/v1/receive This Receiver Handle .
There are two concepts involved here
- Soft tenancy: If the tenant is not explicitly specified in the hash ring configuration file , Then any tenant is considered to be a valid match . All not set HTTP header Or tenant ID Tenant write requests that do not match other hash rings , Will be assigned to the hash ring . Corresponding Receiver The default tenant tag and value will be added to the indicator ( You can use the parameters –receive.default-tenant-id Appoint ).
- Hard tenancy: be-all remote_write The request must go through HTTP header Explicitly specify the tenant ID, The request will enter the matching hash ring for processing .
Be careful :remote_write Requests can be sent to a group of Receiver Any one of , But the final request will be handed over to the matching Receiver To deal with . therefore , Can be in Receiver Add a load balancer to distribute requests randomly Receiver Load balancing of .
From the current documentation ,Thanos Read components such as Querier Etc. does not support multi tenancy , Only through labels (tenant_id) To filter tenant data . If you want to implement multi tenant read , You need to use a third-party program , Please see : Use prom-label-proxy Realization Prometheus Thanos Label based multi tenant reading _ A sunny afternoon blog -CSDN Blog
版权声明
本文为[A sunny afternoon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230600558555.html
边栏推荐
- LeetCode刷题|38外观数组
- Chaos带你快速上手混沌工程
- 【MySQL基础篇】数据导出导入权限与local_infile参数
- memcached 源码分析
- Introduction to common APIs for EBFP programming
- Redis 详解(基础+数据类型+事务+持久化+发布订阅+主从复制+哨兵+缓存穿透、击穿、雪崩)
- Include of ansible module_ Tasks: why is the imported task not executed after adding tags?
- openvswitch vlan网络实践
- rdma网络介绍
- Construire un blog Cloud basé sur ECS (bénédiction sur le Code Cloud Xiaobao, explication détaillée de la tâche iphone13 gratuite)
猜你喜欢
Prometheus的relabel_configs和metric_relabel_configs解释及用法示例
Passerelle haute performance pour l'interconnexion entre VPC et IDC basée sur dpdk
surprise库中evaluate函数弃用解决方法
Implementation of leetcode question brushing str ()
Introduction to common APIs for EBFP programming
搭建基于OSS的图片分享网站-反馈有礼
LeetCode刷题|897递增顺序搜索树
关于 synchronized、ThreadLocal、线程池、Atomic 原子类的 JUC 面试题
[ES6 quick start]
Redis 详解(基础+数据类型+事务+持久化+发布订阅+主从复制+哨兵+缓存穿透、击穿、雪崩)
随机推荐
ebfp编程常用API介绍
虚拟环境中使用jupyter notebook
try catch 不能捕获异步错误
异常记录-17
Winter combat camp hands-on combat - first understand the cloud foundation, hands-on practice ECS ECS ECS novice on the road to get the mouse cloud Xiaobao backpack shadowless
阿里矢量库的图标使用教程(在线,下载)
DNA reveals surprise ancestry of mysterious Chinese mummies
XDP类型的BPF程序
prometheus告警记录持久化(历史告警保存与统计)
switch case时连写常规判断表达式的错误 case和if并用 l
js 格式化当前时间 日期推算
SQL学习|基础查询与排列
ansible模块之include_tasks:为什么加了tags后导入的任务没有执行?
virtio 与vhost_net介绍
你应该知道的 JVM 基础知识
异常记录-10
如何使用TiUP部署一个TiDB v5.0集群
Imitation scallop essay reading page
Openvswitch compilation and installation
异常记录-16