GithubHelp home page GithubHelp logo

file-sync's Introduction

file-sync

数据同步工具

一.问题背景
经常碰到要同步数据的情况,而系统自带的复制功能又不能实现增量同步,每次都要做全量复制,发生异常情况后只能重头再来,非常麻烦,优其是对那种大文件的处理,更是耗时。
二.解決方案
1.计算源目录数据指纹
2.计算目标目录数据指纹
3.对比指纹数据,找出差异项,得到需要添加,删除或更新的文件列表,计算出需要更新的数据大小
4.挨个同步差异项,如果碰到大文件,则缓存其指纹数据到目标文件夹中,供下次同步数据时使用
三.数据指纹说明
数据指纹顾名思义,就是对某一文件夹或文件的唯一标识,其格式为:
文件相对路径+:(分隔符)+修改日期+:+数据长度+:+內容指纹
內容指纹是由多个内容块的md5组成
内容块就是对大文件进行分割处理,每次比较数据,最小的同步对象就是內容块,避免对整个文件做处理,也是实现增量同步的关健点




使用说明:
1.安装Jre
2.下载fileSync.jar
3.运行命令:java -jar fileSync.jar 源目录 目标目录

特性说明:
可增量同步,程序会检测源目录和目标目录已经同步好的数据,
对比之后继续同步未同步的数据



file-sync's People

Contributors

xxonehjh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.