Thanos是一个具有长期存储功能的、开源的、高可用性的、兼容 Prometheus 的接口的监控系统,CNCF 的孵化项目。
介绍
- Thanos 是可以将用户的 Prometheus 存储过渡到具有长期储存功能的监控系统
- 发布地址:https://github.com/thanos-io/thanos/releases
- 发布计划:https://thanos.io/tip/thanos/release-process.md/
- 互动示例:https://killercoda.com/thanos
特点
全局查询(Global Query View):跨多个 Prometheus 实例查询监控指标
无限期保留(Unlimited Retention):使用 OSS 存储监控数据,object storage, like s3/aliyun oss/minio
兼容 Prometheus(Prometheus Compatible):无缝对接 Grafana 等支持 Prometheus API 的客户端
数据降准和压缩(Downsampling & Compaction):重复数据删除、压缩和合并
高可用集群
架构
Deployment with Sidecar for Kubernetes
Sidecar 模式
图片载自
说明:
Sidecar:Thanos 的数据上传组件,用来和 Prometheus 通信,并且将 Prometheus 的监控数据上传到对象存储
Query:Thanos 的查询组件,用来查询监控数据
Store:Thanos 的数据存储组件,用来和对象存储通信,为对象存储提供数据代理服务
Receive:Thanos 的数据收取组件,支持 Prometheus 的远程写功能,对于同一个 Prometheus 实例,只能在 Sidecar 和 Receiver 中间二选一
Rule:Thanos 的集中的告警管理组件
Compactor:Thanos 的数据处理组件,用来将监控数据降准和压缩
Query Frontend:Thanos 的查询前端
tools:Thanos 的运维工具
Receive remote write compatible sources
Receive 数据接收模式
部署
- Thanos 每 6 周发布一个版本
- Thanos 的端口信息如下
| Component |
Interface |
Port |
| Sidecar |
gRPC |
10901 |
| Sidecar |
HTTP |
10902 |
| Query |
gRPC |
10903 |
| Query |
HTTP |
10904 |
| Store |
gRPC |
10905 |
| Store |
HTTP |
10906 |
| Receive |
gRPC (store API) |
10907 |
| Receive |
HTTP (remote write API) |
10908 |
| Receive |
HTTP |
10909 |
| Rule |
gRPC |
10910 |
| Rule |
HTTP |
10911 |
| Compact |
HTTP |
10912 |
| Query Frontend |
HTTP |
10913 |
quickstart
kubernetes
git clone https://github.com/thanos-io/kube-thanos.git
cd kube-thanos
make deploy
make deploy 对应的步骤:
.PHONY: deploy
deploy:
kubectl create ns thanos
kubectl create ns minio
kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v$(PROM_OPERATOR_VERSION)/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
kubectl create -f examples/development-minio/
kubectl create -f manifests/