当前位置:网站首页>Thanos如何为不同租户配置不同的数据保留时长
Thanos如何为不同租户配置不同的数据保留时长
2022-04-23 06:01:00 【洒满阳光的午后】
在之前的实践中我们已经实现了prometheus的多租户读写:Prometheus和Thanos Receiver的“写多租户”实现_洒满阳光的午后的博客-CSDN博客
新的需求是要为不同的租户配置不同的数据保留时长。目前compactor组件天然是不具备多租户能力的,但是它有一个参数
--selector.relabel-config=<content>
Alternative to 'selector.relabel-config-file'
flag (mutually exclusive). Content of YAML file
that contains relabeling configuration that
allows selecting blocks. It follows native
Prometheus relabel-config syntax. See format
details:
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#
可以让compactor在同步对象存储中的block时根据定义的规则进行筛选,利用这个特性,我们就可以实现多租户的概念。
通过配置hashring,不同的租户在不同的receive上会形成不同的block流(可以从compactor组件或bucketweb组件的UI界面查看),这些block流拥有类似如下的标签:
replica: thanos-prod-receive-1
tenant_id: tenant-a
因此我们可以通过为每个租户创建一个compactor,通过selector.relabel-config指定该compactor只处理该租户的block流:
# 租户tenant-a的compactor配置
- |
--selector.relabel-config=
- action: keep
source_labels: ["tenant_id"]
regex: "tenant-a"
- --retention.resolution-raw=180d
- --retention.resolution-5m=180d
- --retention.resolution-1h=180d
# 租户tenant-b的compactor配置
- |
--selector.relabel-config=
- action: keep
source_labels: ["tenant_id"]
regex: "tenant-b"
- --retention.resolution-raw=60d
- --retention.resolution-5m=60d
- --retention.resolution-1h=60d
上述配置可以实现tenant-a数据保留180d,tenant-b数据保留60d。
compactor仍然遵守要单例原则,每个租户仅能配置一个compactor。
版权声明
本文为[洒满阳光的午后]所创,转载请带上原文链接,感谢
https://zhangrongjie.blog.csdn.net/article/details/124302671
边栏推荐
- volatile 关键字的三大特点【数据可见性、指令禁止重排性、不保证操作原子性】
- 【Shell脚本练习】将新加的磁盘批量添加到指定的VG中
- postMan 传参总结
- Imitation scallop essay reading page
- redis 常见问题
- Working principle and practice of browser
- [step by step, even thousands of miles] MySQL reports a large number of unauthenticated user connection errors
- Baidu map coordinates, Google coordinates and Tencent coordinates are mutually transformed
- rdma网络介绍
- [MySQL basics] startup options, system variables and status variables
猜你喜欢
随机推荐
Oracle数据库性能分析之常用视图
Oracle性能分析工具:OSWatcher
【MySQL基础篇】启动选项、系统变量、状态变量
Introduction to the top 12 domestic databases in 2021
LeetCode刷题|13罗马数字转整数
ubuntu下搭建mysql环境 & 初识SQL
TP5 使用redis
异常记录-19
异常记录-10
Oracle Net Service:监听器与服务名解析方法
ES入门学习笔记
【代码解析(1)】Communication-Efficient Learning of Deep Networks from Decentralized Data
Kids and COVID: why young immune systems are still on top
redis 实践笔记和源码分析
The getfield () method in TP5 changes, and TP5 gets the value of a single field
High performance gateway for interconnection between VPC and IDC based on dpdk
[no steps in a small step to a thousand miles] Oracle Application derivative ora-01455 error reporting processing
Centos8 builds php8 0.3 operating environment
【OSS文件上传快速入门】
[MySQL basics] data export and import permissions and local_ Infile parameter