其他分享
首页 > 其他分享> > VictoriaMetrics:使用vmctl来实现vm-storage向victoria-metrics-prod(单机版)迁移数据

VictoriaMetrics:使用vmctl来实现vm-storage向victoria-metrics-prod(单机版)迁移数据

作者:互联网

前一篇提到了,vm-storage的备份数据,无法被victoria-metrics-prod(单机版)读取。
继续翻文档发现vmctl可以实现这个效果:

1.启动vm-restore恢复数据

vmrestore-prod \
  -configFilePath="/etc/cos/config.ini" \
  -credsFilePath="/etc/cos/creds.ini" \
  -customS3Endpoint="https://cos.ap-guangzhou.myqcloud.com" \
  -src="s3://bucket/vm-storage/2021-12-27/" \
  -storageDataPath="/var/victoria-metrics/data/2021-12-27/" \
  -httpListenAddr="0.0.0.0:8420" \
  -memory.allowedBytes=2GB \
  -concurrency=10 \
  -maxBytesPerSecond=100MB 

2.启动vm-storage

vmstorage-prod \
  -memory.allowedBytes 30GB \
  -storageDataPath /var/victoria-metrics/data/2021-12-27/ \
  -retentionPeriod=15d \
  -httpListenAddr 0.0.0.0:8482 \
  -vminsertAddr 0.0.0.0:8400 \
  -vmselectAddr 0.0.0.0:8401 \
  -search.maxTagKeys 100000 \
  -search.maxTagValues 1000000 \
  -search.maxUniqueTimeseries=10000000

3.启动一个vm-select来查询这个节点

vmselect-prod \
  -cacheDataPath /var/victoria-metrics/cache \
  -memory.allowedBytes 10GB \
  -replicationFactor 1 \
  -storageNode 127.0.0.1:8401 \
  -httpListenAddr 0.0.0.0:8481 \
  -search.maxConcurrentRequests 2000 \
  -search.maxPointsPerTimeseries 5000000 \
  -search.maxQueryDuration 600s

4.启动victoria-metrics-prod(单机版)

victoria-metrics-prod \
  -dedup.minScrapeInterval=30s \
  -httpListenAddr="0.0.0.0:8428" \
  -insert.maxQueueDuration=2m \
  -maxInsertRequestSize=500MB \
  -memory.allowedBytes=7GB \
  -retentionPeriod=1y \
  -search.maxConcurrentRequests=500 \
  -search.maxPointsPerTimeseries=100000 \
  -search.maxUniqueTimeseries=1000000 \
  -storageDataPath=/var/victoria-metrics/data/vm-single/data/

5.启动vmctl来传输数据

vmctl-prod vm-native \
  --vm-native-filter-time-start=0 \
  --vm-native-filter-time-end=$(date +"%s") \
  --vm-native-src-addr="http://127.0.0.1:8481/select/0/prometheus/" \
  --vm-native-dst-addr="http://127.0.0.1:8428/"

结论:

标签:search,单机版,0.0,storage,vm,victoria,metrics,prod
来源: https://www.cnblogs.com/ahfuzhang/p/15752233.html