Skip to content

Latest commit

 

History

History
69 lines (43 loc) · 1.93 KB

README.md

File metadata and controls

69 lines (43 loc) · 1.93 KB

Example of Change Data Capture using Kafka Connect

This project is a example implementation of a CDC for SQLServer using Kafka Connect and MongoDB as sink.

It's structured using Docker containers and docker-compose orquestrator tool.

The base docker image used to create the Kafka cluster and related systems is landoop/fast-data-dev (https://github.com/lensesio/fast-data-dev). It creates the Kafka Broker, Zookeeper, Schema Registry, REST Proxy and Kafka Connect Distributed.

The MSSql Server Source connector used is from Debezium (https://debezium.io/). The MongoDB Sink is from MongoDB (https://docs.mongodb.com/kafka-connector/current/).

Requirements

Kafka Web Interfaces

Kafka REST Apis

Internal Components

  • [Kafka Broker]
  • [MongoDB]
  • [SQLServer]

Database Interfaces

docker-compose -f docker-compose.yml exec sqlserver bash -c '/opt/mssql-tools/bin/sqlcmd -U sa -P $MSSQL_SA_PASSWORD -d kafkaconnect'

How to run the project

cd kafka-connect-cdc-example && ./run.sh

Table with CDC enabled

docker-compose -f docker-compose.yml exec sqlserver bash -c '/opt/mssql-tools/bin/sqlcmd -U sa -P $MSSQL_SA_PASSWORD -Q "select * from kafkaconnect.dbo.teste"'

Inserting test data to see the replication

docker-compose -f docker-compose.yml exec sqlserver bash -c \
'/opt/mssql-tools/bin/sqlcmd -U sa -P $MSSQL_SA_PASSWORD -Q "insert into kafkaconnect.dbo.teste(numero, numerogrande, dinheiro, decimo, numeral) values (1,2,3,4,5)"'

Reference

[Mongo DB Kafka] (https://github.com/mongodb/mongo-kafka)

License

Free to use and change for your own purposes.