jenlors
V2EX  ›  Python

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

By jenlors at 2020 年 5 月 8 日 · 2677 次点击

距第一版发布已经过去两三个月,经过不断完善,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 年 5 月 8 日
已 star,clone 下来研究一下
jenlors
   2
jenlors  
OP
   2020 年 5 月 8 日
@azkaban 感谢~
walker2laok
   3
walker2laok  
   2020 年 5 月 11 日
star, 正好借此研究一番...
推荐学习书目
› 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
© 2026 V2EX · 62ms · 3.9.8.5