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

mysql2ch,一个同步 MySQL 数据到 ClickHouse 的项目

  •  
  •   jenlors · 2020-03-19 21:16:35 +08:00 · 2980 次点击
    这是一个创建于 1501 天前的主题,其中的信息可能已经有所发展或是发生改变。

    不久之前发布了初代版本的帖子,https://www.v2ex.com/t/647495#reply5,经过一段时间的升级之后,mysql2ch 升级到了 2.0 版本,功能更完善,跪求各位 star~👉mysql2ch


    mysql2ch

    Introduction

    mysql2ch is used to sync data from MySQL to ClickHouse.

    Requirements

    • kafka
    • docker & docker-compose

    Usage

    Full data etl

    $ python manage.py etl -h
    
    usage: manage.py etl [-h] --schema SCHEMA --tables TABLES [--debug]
    
    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.
      --debug          Display SQL information.
    
    

    Continuous Sync

    1. cp .env.example .env and edit it.
    2. edit docker-compose.yml,which will read .env,add your own consumer.One consumer consume one kafka partition.
    3. docker-compose up -d.

    Optional

    • sentry,error reporting,worked if set SENTRY_DSN in .env.
    5 条回复    2020-03-20 20:04:55 +08:00
    ericFork
        1
    ericFork  
       2020-03-20 06:28:04 +08:00
    解析 binlog 往 kafka 里填的部分是自己实现的么?
    jenlors
        2
    jenlors  
    OP
       2020-03-20 09:27:45 +08:00
    不是,只需要配置好就行了。
    jenlors
        3
    jenlors  
    OP
       2020-03-20 09:27:58 +08:00
    ericFork
        4
    ericFork  
       2020-03-20 17:10:28 +08:00
    @long2ice #2 哦,我的意思是,是你自己造的轮子么?我们是类似的流程,postgresql -> kafka -> clickhouse,不过 postgresql -> kafka 这一步是用 debezium 达成的
    jenlors
        5
    jenlors  
    OP
       2020-03-20 20:04:55 +08:00
    @ericFork 哦哦,借助了 python-mysql-replication 解析 binlog
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1921 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:16 · PVG 00:16 · LAX 09:16 · JFK 12:16
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.