GithubHelp home page GithubHelp logo

dumper-common's Introduction

dumper-common

一个灵活的从数据库中dump数据,并生成指定格式文件的框架

灵感来自于Solr的DIH,针对DIH中比较难理解的部分做了一些的简化。 主要功能:用于小数据量级(未做过100万数据量级的测试)情况下从数据库中Dump数据,支持全量和增量数据dump。 优点: 通过在dumper.xml文件中配置SQL,并配置相应的输出模板,完成指定格式的数据输出,配置非常灵活,更改输出字段时,只需要修改配置文件即可。 dumper.xml中配置的Entity是可嵌套,支持全局Cache,用户需要针对dump的字段进行修改时,可以实现Transformer接口定制自己的方法。 当前使用velocity模板做数据的输出,用户可定制自己的输出类,只需要实现FileWriter接口,并将其配置到dumper.xml文件中即可。

目前整个系统使用的是单线程处理,因此要dump非常大的数据量时,不宜采用该框架。 目前只支持MySQL数据库,针对MySQL的特性,在分页dump时做了相应的SQL优化,不会出现在Dump后面页面数据时,SQL查询太慢的问题。

当前的增量策略的默认实现是使用一个表来记录最近一次执行时间,因此需要使用增量时,需要创建如下表: CREATE TABLE dump_timer ( id int(10) unsigned NOT NULL AUTO_INCREMENT, lasttime int(10) unsigned NOT NULL DEFAULT '0', tbl varchar(250) NOT NULL , PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

插入记录时的tbl的值即是最外层的entity标签的name属性。 当然你也可以实现基于文件的增量策略,只需要实现IncrementSupport接口即可。

dumper-common's People

Contributors

iamxhu avatar

Watchers

 avatar  avatar  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.