MCPcopy Index your code
hub / github.com/Altinity/clickhouse-sink-connector

github.com/Altinity/clickhouse-sink-connector @5.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 5.0.1 ↗ · + Follow
3,586 symbols 6,285 edges 205 files 584 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

License Sink Connector(Kafka version) tests Sink Connector(Light-weight) Tests AltinityDB Slack

Note: Two projects are combined in this repository. 1) #### Altinity Replicator for ClickHouse (Lightweight version) - Single Binary to replicate data from MySQL/PostgreSQL/MongoDB to ClickHouse. - Docker Image - registry.gitlab.com/altinity-public/container-images/clickhouse_debezium_embedded:latest - Java JAR file(Download from releases) - https://github.com/Altinity/clickhouse-sink-connector/releases/download/release_0.6.0/clickhouse-sink-connector-lightweight-1.0-SNAPSHOT.jar - sink-connector-client - Tool to check status of replication, start/stop replication. https://github.com/Altinity/clickhouse-sink-connector/releases/download/release_0.6.0/sink-connector-client - Grafana dashboard - sink-connector-lightweight/docker/config/grafana/config/ - https://github.com/Altinity/clickhouse-sink-connector/tree/develop/sink-connector-lightweight/docker/config/grafana/config 2) #### Altinity Sink Connector for ClickHouse - Kafka Connect Sink connector - Requires Kafka, Debezium source connector and Schema Registry. - Docker Image (https://hub.docker.com/r/altinity/clickhouse-sink-connector/tags) , Java JAR file(Download from releases)

Altinity Replicator for ClickHouse (Lightweight version)

New tool to replicate data from MySQL, PostgreSQL, MariaDB and Mongo without additional dependencies. Single executable and lightweight.

Supports DDL in MySQL.

Usage

From Command line.(JAR)

Download the JAR file from the releases https://github.com/Altinity/clickhouse-sink-connector/releases

Docker-compose:
MySQL

https://github.com/Altinity/clickhouse-sink-connector/blob/develop/sink-connector-lightweight/docker/docker-compose-mysql.yml

Update config.yml https://github.com/Altinity/clickhouse-sink-connector/blob/develop/sink-connector-lightweight/docker/config.yml

  1. Update MySQL information in config.yaml: database.hostname, database.port, database.user and database.password.
  2. Update ClickHouse information in config.yaml: clickhouse.server.url, clickhouse.server.user, clickhouse.server.password, clickhouse.server.port. Also Update ClickHouse information for the following fields that are used to store the offset information- offset.storage.jdbc.url, offset.storage.jdbc.user, offset.storage.jdbc.password, schema.history.internal.jdbc.url, schema.history.internal.jdbc.user, and schema.history.internal.jdbc.password.
  3. Update MySQL databases to be replicated: database.include.list.
  4. Add table filters: table.include.list.
  5. Set snapshot.mode to initial if you like to replicate existing records, set snapshot.mode to schema_only to replicate schema and only the records that are modified after the connector is started.
  6. Start replication by running the JAR file. java -jar clickhouse-debezium-embedded-1.0-SNAPSHOT.jar <yaml_config_file> or docker. ClickHouse HTTPS servers For https servers, make sure the clickhouse.server.url includes https Also add ?ssl=true and port 8443 to both the offset.storage.jdbc.url and schema.history.internal.jdbc.url configuration variables. Example: ClickHouse Cloud
clickhouse.server.url: "https://cloud_url"
offset.storage.jdbc.url: "jdbc:clickhouse://cloud_url:8443/altinity_sink_connector?ssl=true"
schema.history.internal.jdbc.url: "jdbc:clickhouse://cloud_url:8443/altinity_sink_connector?ssl=true"

MySQL Configuration

MySQL Configuration

PostgreSQL Configuration

For AWS RDS users, you might need to add heartbeat interval and query to avoid WAL logs constantly growing in size. https://stackoverflow.com/questions/76415644/postgresql-wal-log-limiting-rds https://debezium.io/documentation/reference/stable/connectors/postgresql.html#postgresql-wal-disk-space

PostgreSQL Configuration

Command Line(JAR)

https://github.com/Altinity/clickhouse-sink-connector/releases

java -jar clickhouse-debezium-embedded-1.0-SNAPSHOT.jar <yaml_config_file>

Docker compose

export SINK_LIGHTWEIGHT_VERSION=latest

MySQL

cd sink-connector-lightweight/docker
docker-compose -f docker-compose-mysql.yml up

MySQL (Connect to external MySQL and ClickHouse configuration)

cd sink-connector-lightweight/docker
docker-compose -f docker-compose-mysql-standalone.yml up

PostgreSQL

cd sink-connector-lightweight/docker
docker-compose -f docker-compose-postgres.yml up

https://altinity.com/blog/replicating-data-from-postgresql-to-clickhouse-with-the-altinity-sink-connector

PostgreSQL(Connect to external PostgreSQL and ClickHouse configuration)

cd sink-connector-lightweight/docker
docker-compose -f docker-compose-postgres-standalone.yml up
Docker

Images are published in Gitlab.

registry.gitlab.com/altinity-public/container-images/clickhouse_debezium_embedded:latest

Docker Setup instructions

CLI tool (To start/stop replication and set binlog status and gtid) - Start replication from a specific binlog position or gtid

Download the sink-connector-client from the latest releases.

 ./sink-connector-client 
NAME:
   Sink Connector Lightweight CLI - CLI for Sink Connector Lightweight, operations to get status, start/stop replication and set binlog/gtid position

USAGE:
   sink-connector-client [global options] command [command options] [arguments...]

VERSION:
   1.0

COMMANDS:
   start_replica        Start the replication
   stop_replica         Stop the replication
   show_replica_status  Status of replication
   update_binlog        Update binlog file/position and gtids
   help, h              Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --host value   Host server address of sink connector
   --port value   Port of sink connector
   --secure       If true, then use https, else http
   --help, -h     show help
   --version, -v  print the version


Configuration

Configuration Description
database.hostname Source Database HostName
database.port Source Database Port number
database.user Source Database Username(user needs to have replication permission, Refer https://debezium.io/documentation/reference/stable/connectors/mysql.html) GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON . TO 'user' IDENTIFIED BY 'password';
database.password Source Database Password
database.include.list List of databases to be included in replication.
table.include.list List of tables to be included in replication.
clickhouse.server.url ClickHouse URL, For TLS(use https and set port to 8443)
clickhouse.server.user ClickHouse username
clickhouse.server.password ClickHouse password
clickhouse.server.port ClickHouse port, For TLS(use the correct port 8443 or 443
clickhouse.server.database ClickHouse destination database

Extension points exported contracts — how you extend this code

DebeziumRecordParserService (Interface)
(no doc) [3 implementers]
sink-connector-lightweight/src/main/java/com/altinity/clickhouse/debezium/embedded/parser/DebeziumRecordParserService.java
AbstractConverter (Interface)
(no doc) [2 implementers]
sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/converters/AbstractConverter.java
ConfigurationService (Interface)
(no doc) [3 implementers]
sink-connector-lightweight/src/main/java/com/altinity/clickhouse/debezium/embedded/config/ConfigurationService.java
DDLParserService (Interface)
(no doc) [2 implementers]
sink-connector-lightweight/src/main/java/com/altinity/clickhouse/debezium/embedded/ddl/parser/DDLParserService.java

Core symbols most depended-on inside this repo

node
called by 219
sink-connector-lightweight/tests/integration/helpers/cluster.py
toString
called by 172
sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/metadata/SchemaPair.java
put
called by 162
sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/ClickHouseSinkTask.java
query
called by 114
sink-connector-lightweight/tests/integration/helpers/cluster.py
name
called by 94
sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/metadata/SinkRecordField.java
getuid
called by 83
sink-connector-lightweight/tests/integration/helpers/common.py
node
called by 66
sink-connector/tests/integration/helpers/cluster.py
command
called by 57
sink-connector-lightweight/tests/integration/helpers/cluster.py

Shape

Method 2,998
Function 437
Class 130
Enum 12
Interface 4
Route 3
Struct 2

Languages

Python50%
Java49%
Go1%

Modules by API surface

sink-connector-lightweight/src/main/java/com/altinity/clickhouse/debezium/embedded/ddl/parser/MySqlDDLParserListenerImpl.java1,275 symbols
sink-connector/python/db_load/mysql_parser/MySqlParserListener.py1,205 symbols
sink-connector/tests/integration/helpers/cluster.py48 symbols
sink-connector-lightweight/tests/integration/helpers/cluster.py48 symbols
sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ddl/parser/MySqlDDLParserListenerImplTest.java40 symbols
sink-connector/tests/integration/helpers/common.py25 symbols
sink-connector-lightweight/tests/integration/helpers/common.py25 symbols
sink-connector-lightweight/tests/integration/tests/delete.py23 symbols
sink-connector/python/db_load/clickhouse_loader.py22 symbols
sink-connector-lightweight/src/main/java/com/altinity/clickhouse/debezium/embedded/cdc/DebeziumChangeEventCapture.java22 symbols
sink-connector-lightweight/tests/integration/tests/update.py21 symbols
sink-connector-lightweight/tests/integration/tests/alter.py20 symbols

Datastores touched

(mysql)Database · 1 repos
(mongodb)Database · 1 repos

For agents

$ claude mcp add clickhouse-sink-connector \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact