当前位置:网站首页>Implementation of multi tenant read and write in Prometheus cortex
Implementation of multi tenant read and write in Prometheus cortex
2022-04-23 07:04:00 【A sunny afternoon】
Cortex All components of the will be from each request header Of X-Scope-OrgID Get tenants from ID. The tenant here represents the owner of a set of data , It is to Cortex Write data , And have the query authority of the data . be-all Cortex Components will be unconditionally trusted X-Scope-OrgID Request , So if you want to protect Cortex Protection from malicious calls , You need to add a protective layer by yourself .
Note the tenants who query and write requests ID It has to be consistent , Otherwise, the required data cannot be queried .
Enable the multi tenant feature
By adding auth.enabled=true, Or the command line -auth.enabled=true Enable the multi tenant feature . for example :
./cortex -target=distributor -auth.enabled=true
If you want to disable multi tenancy , You need to pass parameters to all components auth.enabled=false, In this case, all requests X-Scope-OrgID Will be set to "fake".
Prometheus To configure
The first method is to directly remote_write Add in configuration header Information .
remote_write:
- url: http://<cortex>/prometheus/api/v1/push
headers:
X-Scope-OrgID: <org>
The second method is to use Cortex-Tenant, Add... Based on existing tag values header Information .
Cortex Tenant Placed in Prometheus and Cortex Between , When Prometheus When a write request for passes through the component ,Cortex Tenant Will search for the value of the predefined tag , And use it as X-Scope-OrgID Add the value of to the request header in , And then forwarded to Cortex.
See the detailed usage method :
This component is a third-party component , Not Cortex Team maintenance .
Query side configuration
at present Cortex There is no front-end query page for multi tenant , In the use of Grafana As a client query , Multi tenant query can be implemented according to the following scheme .( At present, it is only an idea , Not yet practiced and tested , The theory works )
Scheme 1 :
stay Grafana And Cortex Place a layer between Nginx Reverse proxy ,Nginx Add a configuration similar to the following :
server {
server_name prod.com
location / {
proxy_pass http://cortex;
proxy_set_header X-Scope-OrgID <prod tenant ID>;
}
}
server {
server_name ops.com
location / {
proxy_pass http://cortex;
proxy_set_header X-Scope-OrgID <ops tenant ID>;
}
}
Grafana The side passes different tenants Org To separate from each other , Configure different data sources , In this way, different tenants can only query their own data .
Option two :
stay Grafana When adding data sources to , To configure Custom HTTP Headers.
版权声明
本文为[A sunny afternoon]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230600558709.html
边栏推荐
- [step by step, even thousands of miles] MySQL reports a large number of unauthenticated user connection errors
- 异常记录-18
- Basic concepts of database: OLTP / OLAP / HTAP, RPO / RTO, MPP
- Kids and COVID: why young immune systems are still on top
- 【ES6快速入门】
- ebfp编程常用API介绍
- [ES6 quick start]
- 【不积跬步无以至千里】MySQL报大量unauthenticated user连接错误
- Prometheus Cortex使用Block存储时的相关问题
- 将博客搬至CSDN
猜你喜欢
基於DPDK實現VPC和IDC間互聯互通的高性能網關
Kids and COVID: why young immune systems are still on top
Prometheus的relabel_configs和metric_relabel_configs解释及用法示例
冬季实战营 动手实战-初识上云基础,动手实操ECS云服务器新手上路 领鼠标 云小宝 背包 无影
Prometheus Cortex使用Block存储时的相关问题
SQL学习|复杂查询
Web登录小案例(含验证码登录)
Practice of openvswitch VLAN network
【OSS文件上传快速入门】
openvswitch vlan网络实践
随机推荐
volatile 关键字的三大特点【数据可见性、指令禁止重排性、不保证操作原子性】
Oracle Performance Analysis Tool: oswatcher
异常记录-15
XDP类型的BPF程序
通过源码探究@ModelAndView如何实现数据与页面的转发
js 格式化当前时间 日期推算
Winter combat camp hands-on combat - cloud essential environment preparation, hands-on practical operation, quickly build lamp environment, lead mouse cloud Xiaobao backpack without shadow
异常记录-19
Include of ansible module_ Tasks: why is the imported task not executed after adding tags?
tensorflow下载
Get DOM element location information by offset and client
virtio 与vhost_net介绍
基於ECS搭建雲上博客(雲小寶碼上送祝福,免費抽iphone13任務詳解)
阅读笔记:Meta Matrix Factorization for Federated Rating Predictions
SSM项目在阿里云部署
Use the SED command to process text efficiently
将博客搬至CSDN
【ES6快速入门】
surprise库中evaluate函数弃用解决方法
异常记录-14