V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
jenlors
V2EX  ›  Python

各位,我又来求 star 了, mysql2ch,一个同步 MySQL 到 Clickhouse 的工具

  •  
  •   jenlors · 2020-05-08 16:28:54 +08:00 · 1893 次点击
    这是一个创建于 1462 天前的主题,其中的信息可能已经有所发展或是发生改变。

    距第一版发布已经过去两三个月,经过不断完善,mysql2ch 已经发布 0.4.0 版本了~

    特性

    • 支持全量同步与增量同步。
    • 支持 DDL 与 DML,当前支持 DDL 字段新增与删除,支持所有的 DML,增删改全部可以同步。
    • 丰富的配置项。

    依赖

    • kafka,缓冲 MySQL binlog 的消息队列。
    • redis,缓存 MySQL binlog position 与 file 。

    用法

    全量同步

    $ mysql2ch etl -h
    
    usage: mysql2ch etl [-h] --schema SCHEMA [--tables TABLES] [--renew]
    
    optional arguments:
      -h, --help       show this help message and exit
      --schema SCHEMA  Schema to full etl.
      --tables TABLES  Tables to full etl,multiple tables split with comma,default read from environment.
      --renew          Etl after try to drop the target tables.
    
    

    监听 binlog

    $ mysql2ch produce
    

    消费消息并插入 ClickHouse

    $ mysql2ch consume -h
    
    usage: mysql2ch consume [-h] --schema SCHEMA [--skip-error] [--auto-offset-reset AUTO_OFFSET_RESET]
    
    optional arguments:
      -h, --help            show this help message and exit
      --schema SCHEMA       Schema to consume.
      --skip-error          Skip error rows.
      --auto-offset-reset AUTO_OFFSET_RESET
                            Kafka auto offset reset,default earliest.
    

    项目地址

    https://github.com/long2ice/mysql2ch,求个 star~👍

    3 条回复    2020-05-11 09:01:01 +08:00
    azkaban
        1
    azkaban  
       2020-05-08 16:37:53 +08:00
    已 star,clone 下来研究一下
    jenlors
        2
    jenlors  
    OP
       2020-05-08 17:12:08 +08:00
    @azkaban 感谢~
    walker2laok
        3
    walker2laok  
       2020-05-11 09:01:01 +08:00
    star, 正好借此研究一番...
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3385 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:02 · PVG 20:02 · LAX 05:02 · JFK 08:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.