当前位置:网站首页>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
边栏推荐
- 基於DPDK實現VPC和IDC間互聯互通的高性能網關
- ansible模块之include_tasks:为什么加了tags后导入的任务没有执行?
- 通过源码探究@ModelAndView如何实现数据与页面的转发
- How to use DBA_ hist_ active_ sess_ History analysis database history performance problems
- 基于DPDK实现VPC和IDC间互联互通的高性能网关
- JS realizes modal box dragging
- 异常记录-9
- 异常记录-19
- file_ get_ Two solutions to content accessing SSL errors
- Oracle性能分析工具:OSWatcher
猜你喜欢
随机推荐
【代码解析(7)】Communication-Efficient Learning of Deep Networks from Decentralized Data
SQL学习|集合运算
How to use tiup to deploy a tidb V5 0 cluster
Imitation scallop essay reading page
Kids and COVID: why young immune systems are still on top
端口占用1
Common views of Oracle database performance analysis
阅读笔记:FedGNN: Federated Graph Neural Network for Privacy-Preserving Recommendation
Oracle Net Service:监听器与服务名解析方法
ES6 specification details
[fish in the net] ansible awx calls playbook to transfer parameters
tensorflow下载
[MySQL basics] data export and import permissions and local_ Infile parameter
Solution to page cache problem (use with caution)
PHP background parsing after JQ serialization
异常记录-16
Curry realization of function continuous call calculation and accumulation
异常记录-5
异常记录-11
异常记录-13