已經設計過一個使用簡單單機模式的,以下是一個關於集群模式的試用
環境准備
- 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