clickhouse-sink-connector/sink-connector-lightweight
2023-09-28 17:51:46 +03:00
..
clickhouse Merge lightweight connector 2023-04-04 13:29:46 -04:00
doc Fixed testflow path for logs in github workflow. 2023-04-05 10:53:36 -04:00
docker PR fixes and actions non-classic run 2023-08-09 17:01:48 +03:00
gen Merge lightweight connector 2023-04-04 13:29:46 -04:00
helm/clickhouse-debezium-embedded Merge lightweight connector 2023-04-04 13:29:46 -04:00
img Merge lightweight connector 2023-04-04 13:29:46 -04:00
scripts Fix github workflow for running lightweight sink connector integration tests. 2023-04-04 15:44:11 -04:00
sql Merge lightweight connector 2023-04-04 13:29:46 -04:00
src Disable Mongo integration tests 2023-04-07 17:20:30 -04:00
tests more coverage lw update 2023-09-28 17:51:46 +03:00
build_docker_arm.sh Merge lightweight connector 2023-04-04 13:29:46 -04:00
build_docker.sh Modified pom.xml in lightweight to use sink-connector as additional sources. 2023-04-05 15:57:32 -04:00
Dockerfile Merge lightweight connector 2023-04-04 13:29:46 -04:00
LICENSE Merge lightweight connector 2023-04-04 13:29:46 -04:00
pom.xml Fix multiple debezium-core libaries in maven. 2023-04-07 14:02:56 -04:00
README.md Update installation instructions link. 2023-04-04 14:40:56 -04:00

Configuration

Configuration

export database.hostname="mysql-master"
export database.port="3306"
export database.user="root"
export database.password="root"
export database.include.list=sbtest
#export table.include.list=sbtest1
export database.allowPublicKeyRetrieval"="true"
export snapshot.mode="schema_only"
export connector.class="io.debezium.connector.mysql.MySqlConnector"
export clickhouse.server.database="test"
export auto.create.tables=true
export replacingmergetree.delete.column="_sign"
export metrics.port=8083
export clickhouse.server.url="clickhouse"
export clickhouse.server.user="root"
export clickhouse.server.pass="root"
export clickhouse.server.port="8123"

In deploy\docker.env, Update MySQL and ClickHouse configuration.

MySQL

export database.hostname="localhost"
export database.port="3306"
export database.user="root"
export database.password="root"
export database.whitelist="test"

ClickHouse

export clickhouse.server.url="clickhouse"
export clickhouse.server.user="root"
export clickhouse.server.pass="root"
export clickhouse.server.port="8123"

PostgreSQL


export database.hostname="postgres"
export database.port="5432"
export database.user="root"
export database.password="root"
export snapshot.mode="schema_only"
export connector.class="io.debezium.connector.postgresql.PostgresConnector"
export plugin.name="pgoutput"
export table.include.list="public.tm"
export clickhouse.server.database="test"
export auto.create.tables=true
export replacingmergetree.delete.column="_sign"
export metrics.port=8083
export clickhouse.server.url="clickhouse"
export clickhouse.server.user="root"
export clickhouse.server.pass="root"
export clickhouse.server.port="8123"

PostgreSQL specific configuration:

export connector.class="io.debezium.connector.postgresql.PostgresConnector"
export database.dbname="public"
export plugin.name="pgoutput"

Helm Charts

Update the MySQL/PostgreSQL and ClickHouse configuration values `

  - name: database.hostname
    value: "127.0.0.1"
  - name: database.port
    value: "3306"
  - name: database.dbname
    value: "public"
  - name: database.user
    value: "root"
  - name: database.password
    value: "adminpass"
  - name: snapshot.mode
    value: "initial"
  - name: connector.class
    value: "io.debezium.connector.postgresql.PostgresConnector"
  - name: plugin.name
    value: "pgoutput"
  - name: table.include.list
    value: "public.tm"
  - name: offset.storage
    value: "org.apache.kafka.connect.storage.FileOffsetBackingStore"
  - name: offset.storage.file.filename
    value: "filename"
  - name: offset.flush.interval.ms
    value: "60000"
  - name: auto.create.tables
    value: "true"
  - name: clickhouse.server.url
    value: "localhost"
  - name: clickhouse.server.port
    value: "8123"
  - name: clickhouse.server.user
    value: "default"
  - name: clickhouse.server.pass
    value: "2"
  - name: clickhouse.server.database
    value: "public"
  - name: replacingmergetree.delete.column
    value: "_sign"
  - name: database.allowPublicKeyRetrieval
    value: "true"
  - name: metrics.enable
    value: "true"
  - name: metrics.port
    value: "8083"
cd helm
helm install clickhouse-debezium-embedded .

Getting started (Docker-compose)

Build the JAR file mvn clean install

Build docker images and start docker compose cd docker
docker-compose build

MySQL need to be started before starting the application\

Start MySQL docker
docker-compose -f docker-compose-mysql.yml up

Start application
docker-compose up

DDL Support:

With Datatype conversion(From MySQL to ClickHouse)

ALTER TABLE

MySQL ClickHouse
ADD COLUMN
ADD COLUMN NULL/NOT NULL
ADD COLUMN DEFAULT
ADD COLUMN FIRST, AFTER
DROP COLUMN
MODIFY COLUMN data_type
MODIFY COLUMN data_type NULL/NOT NULL
MODIFY COLUMN data_type DEFAULT
MODIFY COLUMN FIRST, AFTER
MODIFY COLUMN old_name new_name datatype NULL/NOT NULL
RENAME COLUMN col1 to col2
CHANGE COLUMN FIRST, AFTER MODIFY COLUMN
ALTER COLUMN col_name ADD DEFAULT Not supported by grammar
ALTER COLUMN col_name ADD DROP DEFAULT Not supported by grammar
ADD PRIMARY KEY Cannot modify primary key in CH
ADD INDEX Secondary indexes in CH, what about type and index granularity?
ADD CONSTRAINT (CHECK)
ADD CONSTRAINT Add constraint with Primary key(Not supported)
DROP CONSTRAINT Add constraint with Primary key(Not supported)
RENAME CONSTRAINT Add constraint with Primary key(Not supported)

TABLE operations

MySQL ClickHouse
RENAME TABLE name_1 to name_2
TRUNCATE TABLE
DROP TABLE name_1
DROP TABLE name_1, name_2

DATABASE operations

MySQL ClickHouse
CREATE DATABASE
USE DATABASE