TiDB:Prometheus 安全访问策略配置全指南
作者: cchouqiang 原文来源:https://tidb.net/blog/06f93693
一、Prometheus Basic Auth 使用背景
TiDB 集群在默认情况下,对 Prometheus 监控数据是没有加密的,通过浏览器可以直接访问 Prometheus,可能会导致监控数据信息遭遇泄漏。如果需要对 Prometheus 监控数据进行安全加密,则需要使用 Prometheus Basic Auth 。
二、方案简介
Prometheus 于 2.24 版本(包括 2.24)之后提供 Basic Auth 功能进行加密访问,在浏览器登录 UI 的时候需要输入用户密码,访问 Prometheus api 的时候也需要加上用户密码。
配置 Prometheus 加密步骤:
预制用户密码,其中密码可使用 python3 工具包加密
创建对应用户加密密码配置文件
升级 TiUP 到 1.15.0 版本及以上(TiDB 8.0 以上)
TiUP 配置 Prometheus 登录安全验证参数
Grafana 监控配置 Prometheus 登录验证
三、升级 TiUP & TiUP Cluster 到 1.15.0 以上
以离线集群为 TiDB v6.5.5 版本为例,从 TiDB 官网下载 V8.1.0 LTS 及以上 TiDB-community-server 软件包 https://cn.pingcap.com/product-community/
上传并解压安装包
升级 TiUP &TiUP Cluster
四、配置 Prometheus 安全认证
1、编写验证配置文件
使用 python 生成的密码:12$kXxrZP74Fmjh6Wih0Ignu.uWSiojl5aKj4UnMvHN9s2h/Lc/ui0.S
2、检测是否可用

3、TiUP 配置 Prometheus 启动参数
4、重启加载 Prometheus 配置
5、访问 Prometheus UI

6、直接访问 Prometheus http API 接口

7、带用户信息访问 Prometheus http API 接口

五、配置 grafana 数据源 Prometheus 登录验证


版权声明: 本文为 InfoQ 作者【TiDB 社区干货传送门】的原创文章。
原文链接:【http://xie.infoq.cn/article/7be983181730dfd160243d4a6】。文章转载请联系作者。
评论