mysql2ch to sync data from MySQL to ClickHouse, support full and increment.
- Full data etl and continuous sync.
- Support DDL and DML sync,current support
add column
anddrop column
of DDL, and full support of DML also. - Rich configurable items.
- Consumer and producer monitor ui.
- kafka,message queue to store mysql binlog event.
- redis,cache mysql binlog file and position and store monitor data.
$ pip install mysql2ch
Make a .env
file in execute dir or set system environment variable:
Example .env.
Maybe you need make full data etl before continuous sync data from MySQL to ClickHouse or redo data etl with --renew
.
$ 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.
--renew Etl after try to drop the target tables.
Listen all MySQL binlog and produce to kafka.
$ mysql2ch produce
Consume message from kafka and insert to ClickHouse,and you can skip error with --skip-error
.
$ 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.
$ mysql2ch ui -h
usage: mysql2ch ui [-h] [--host HOST] [-p PORT]
optional arguments:
-h, --help show this help message and exit
--host HOST Listen host.
-p PORT, --port PORT Listen port.
Example docker-compose.yml.
Sentry,error reporting,worked if set SENTRY_DSN
in .env
.
This project is licensed under the MIT License.