Coder Social home page Coder Social logo

mergedb's Introduction

#MergeDb# 用于对于不同源有相同表结构的库表进行合表便于纵向分析

环境要求:

python 2.7 版本
mysql 5.5以上

安装库:

pip install pymysql
pip install mysql-replication

使用方法:

  1. 授权主从用户

    mysql 执行 grant select,replication slave,replication client on . to 'mergedb'@"localhost" identified by 'mergedb';FLUSH PRIVILEGES;

  2. 异构端授权增删改查权限用户,以tidb为例

  3. 配置文件设置

    [mysql]
    user = mergedb
    passwd = mergedb
    host = localhost
    port = 3306
    charset = UTF8
    #socket 根据实际情况而定
    unix_socket = /opt/lampp/var/mysql/mysql.sock
    #server_id 根据实际情况而定
    server_id = 1
    #tidb 
    [tidb]
    user = meregdb
    passwd = meregdb
    host = your ip
    port = your port
    db = your db
    charset = UTF8
    #异构字段可以再次添加多个
     [addfield]
    clientid = 2
    #多个schema route 可以用逗号隔开,一一对应
    [route-rules]
    only_schema = chain
    route_schema = scm_merge_db
  4. 注意事项

    log_pos,log_file 第一次记录需要手动填进去,之后会自动记录更新

  5. 测试运行

    python row_merge.py

  6. 生产环境

    sh service start

参考文献

[文献1] (https://github.com/bjbean/mysqlbinlog-analysis "1")

mergedb's People

Contributors

haochenxiao666 avatar

Watchers

 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.