当前位置:网站首页>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
边栏推荐
- 用反射与注解获取两个不同对象间的属性值差异
- [MySQL basics] startup options, system variables and status variables
- 端口占用1
- Ansible基本命令、角色、内置变量与tests判断
- Prometheus Cortex多租户读写的实现
- Passerelle haute performance pour l'interconnexion entre VPC et IDC basée sur dpdk
- MySQL【sql性能分析+sql调优】
- 【不积跬步无以至千里】MySQL报大量unauthenticated user连接错误
- 【不积跬步无以至千里】Oracle应用导数Ora-01455报错处理
- [ES6 quick start]
猜你喜欢
随机推荐
ES6 specification details
异常记录-22
TP5 使用redis
[Lombok quick start]
MySQL【ACID+隔离级别+ redo log + undo log】
Oracle Net Service:监听器与服务名解析方法
用反射与注解获取两个不同对象间的属性值差异
Practice of openvswitch VLAN network
fdfs启动
【Lombok快速入门】
将博客搬至CSDN
如何通过dba_hist_active_sess_history分析数据库历史性能问题
多线程
修改Jupyter Notebook样式
关于注解1
时间格式不对,运行sql文件报错
Number of stair climbing methods of leetcode
异常记录-15
How to use DBA_ hist_ active_ sess_ History analysis database history performance problems
Baidu map coordinates, Google coordinates and Tencent coordinates are mutually transformed









