zoukankan      html  css  js  c++  java
  • 【源码阅读】VictoriaMetrics中理解vmbackup中设置origin地址的用途

    lib/backup/actions/backup.go:

            // 118 行
    	partsToCopy := common.PartsDifference(srcParts, dstParts)   //要上传的文件列表
    	originCopyParts := common.PartsIntersect(originParts, partsToCopy)  // 旧的备份地址中的文件列表,与要上传的文件列表取交集。
            // 交集的文件列表,只要调用对象存储的云端COPY能力就行,这样就节省了带宽,不用浪费再上传一次。
            //  对于云端对象存储而言,同一个文件复制多份,就是增加一个引用计数,而不必真正的产生拷贝。因此对象存储中的大量相同文件并不浪费空间。
    	copySize := getPartsSize(originCopyParts)
    	if len(originCopyParts) > 0 {
    		logger.Infof("server-side copying %d parts from origin %s to dst %s", len(originCopyParts), origin, dst)
    		copiedParts := uint64(0)
    		err = runParallel(concurrency, originCopyParts, func(p common.Part) error {
    			logger.Infof("server-side copying %s from origin %s to dst %s", &p, origin, dst)
                            // 使用 CopyPart 的方法来在云端复制文件
    			if err := dst.CopyPart(origin, p); err != nil {
    				return fmt.Errorf("cannot copy %s from origin %s to dst %s: %w", &p, origin, dst, err)
    			}
    			atomic.AddUint64(&copiedParts, 1)
    			return nil
    		}, func(elapsed time.Duration) {
    			n := atomic.LoadUint64(&copiedParts)
    			logger.Infof("server-side copied %d out of %d parts from origin %s to dst %s in %s", n, len(originCopyParts), origin, dst, elapsed)
    		})
    		if err != nil {
    			return err
    		}
    	}
    

    总结:

    • 每次vmbackup产生的备份,都是一个-retentionPeriod指定的时间长度的完整TSDB数据;
    • 从而,vm体系中并不存在只含有增量数据的分片
      • 例如:按天备份,是那一天倒推30天的数据。
      • 无法单独的增量的备份出某一天的数据
  • 相关阅读:
    C#磁吸屏幕窗体类库
    准备
    我写的诗
    How to turn off a laptop keyboard
    How to tell which commit a tag points to in Git?
    Why should I care about lightweight vs. annotated tags?
    How to get rid of “would clobber existing tag”
    Facebook, Google and Twitter threaten to leave Hong Kong over privacy law changes
    The need for legislative reform on secrecy orders
    Can a foreign key be NULL and/or duplicate?
  • 原文地址:https://www.cnblogs.com/ahfuzhang/p/15747554.html
Copyright © 2011-2022 走看看