距第一版发布已经过去两三个月,经过不断完善,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~👍