cortex 基本试用

cortext是prometheus的多租户解决方案,目前在cncf 沙箱孵化,以下是一个简单的试用

注意因为golang 包的问题,而且以下依赖的几个项目都是基于go module 的所以使用了goproxy 配置,具体配置为:
export GOPROXY=https://goproxy.cn/,此处运行的是单实例模式

单实例,单进程运行

  • clone cortex 代码
git clone  https://github.com/cortexproject/cortex.git
  • 构建
cd cortex
go build ./cmd/cortex
  • 启动
./cortex -config.file=./docs/single-process-config.yaml
  • prometheus 运行

    也是基于源码构建,同时需要添加remote_write

clone prometheus 代码

git clone https://github.com/prometheus/prometheus

构建prometheus

cd prometheus
go build ./cmd/prometheus

修改demo 配置
documentation/examples/prometheus.yml 添加以下内容

remote_write:
- url: http://localhost:9009/api/prom/push
  • 运行
./prometheus --config.file=./documentation/examples/prometheus.yml
  • 运行grafana dashboard工具
    docker 启动
 
docker run -d --name=grafana -p 3000:3000 grafana/grafana

添加promethesu datasource
注意修改为自己的docker 主机ip

http://host.docker.internal:9009/api/prom
 

 

 


说明:为了对比,最好也添加下原生prometheus server

运行效果

  • 通过grafana 查询对比

 

 

  • 数据存储效果

demo 数据存放在/tmp/cortex 内容如下:

 

 

说明

以上是一个简单的单机运行试用,后边会试用docker-compose 运行多实例

参考资料

https://github.com/cortexproject/cortex/blob/master/docs/getting_started.md

posted on   荣锋亮  阅读(1380)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2018-09-29 nuclio kubernetes 部署
2018-09-29 nuclio dokcer 运行测试

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示