victoriametrics 集群模式试用
已经设计过一个使用简单单机模式的,以下是一个关于集群模式的试用
环境准备
- docker-compose 文件
version: "3"
services:
prometheus:
image: prom/prometheus
ports:
- 9090:9090
volumes:
- ./promdata:/prometheus
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
vmstorage:
image: victoriametrics/vmstorage
ports:
- 8482:8482
- 8400:8482
- 8401:8482
volumes:
- ./strgdata:/storage
command:
- '--storageDataPath=/storage'
vminsert:
image: victoriametrics/vminsert
command:
- '--storageNode=vmstorage:8400'
ports:
- 8480:8480
vmselect:
image: victoriametrics/vmselect
command:
- '--storageNode=vmstorage:8401'
ports:
- 8481:8481
grafana:
image: grafana/grafana
ports:
- 3000:3000
- prometheus.yml 配置文件
global:
scrape_interval: 1s
evaluation_interval: 1s
remote_write:
- url: "http://vminsert:8480/insert/0/prometheus/"
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090']
- job_name: 'vminsert'
static_configs:
- targets: ['vminsert:8480']
- job_name: 'vmselect'
static_configs:
- targets: ['vmselect:8481']
- job_name: 'vmstorage'
static_configs:
- targets: ['vmstorage:8482']
- job_name: 'app'
scrape_interval: 20s
static_configs:
- targets: ['node-exporter:9100']
- 简单说明
remote_write 格式: http://<vminsert>:8480/insert/<accountID>/<suffix>
比如prometheus的为:http://vminsert:8480/insert/0/prometheus/
启动&&试用
- 启动
docker-compose up -d
- prometheus 效果
- grafana 效果
数据源配置,格式:http://vmselect:8481/select/0/prometheus
查询效果:
说明
前边有介绍过关于集群的配置,以及扩容说明,后边尝试下关于集群的扩容处理
参考资料
https://github.com/VictoriaMetrics/VictoriaMetrics/tree/cluster