Debezium — Real-Time Change Data Capture Platform
A distributed platform for streaming database changes into event logs, capturing row-level inserts, updates, and deletes from MySQL, PostgreSQL, MongoDB, and more.
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install 7545d7aa-39e1-11f1-9bc6-00163e2b0d79 --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
What it is
Debezium is a distributed platform for change data capture (CDC). It monitors database transaction logs and streams row-level inserts, updates, and deletes into Apache Kafka topics. Debezium supports MySQL, PostgreSQL, MongoDB, SQL Server, Oracle, Cassandra, and Db2.
Debezium targets data engineers and platform teams building real-time data pipelines, event-driven architectures, cache invalidation systems, and data warehouse synchronization.
How it saves time or tokens
Debezium eliminates polling-based data synchronization. Instead of querying databases on an interval to detect changes, Debezium reads the transaction log and emits changes as they happen. This reduces database load, eliminates missed changes between poll intervals, and provides sub-second latency. The Kafka Connect architecture means you configure connectors declaratively without writing code.
How to use
- Start the required infrastructure:
docker run -d --name zookeeper -p 2181:2181 quay.io/debezium/zookeeper
docker run -d --name kafka -p 9092:9092 \
--link zookeeper quay.io/debezium/kafka
docker run -d --name connect -p 8083:8083 \
--link kafka --link zookeeper quay.io/debezium/connect
- Register a MySQL connector:
curl -X POST http://localhost:8083/connectors -H 'Content-Type: application/json' -d '{
"name": "mysql-connector",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"database.hostname": "mysql",
"database.port": "3306",
"database.user": "debezium",
"database.password": "dbz",
"database.server.id": "1",
"topic.prefix": "dbserver1",
"schema.history.internal.kafka.bootstrap.servers": "kafka:9092",
"schema.history.internal.kafka.topic": "schema-changes"
}
}'
- Consume change events from Kafka topics named
dbserver1.<database>.<table>.
Example
A Debezium change event JSON structure:
{
"before": {"id": 1, "name": "Alice", "email": "alice@old.com"},
"after": {"id": 1, "name": "Alice", "email": "alice@new.com"},
"source": {"db": "inventory", "table": "customers"},
"op": "u",
"ts_ms": 1713000000000
}
Related on TokRepo
- Database tools — database utilities and connectors
- DevOps tools — infrastructure and data pipeline resources
Common pitfalls
- MySQL requires binlog_format=ROW and binlog_row_image=FULL. Without these settings, Debezium cannot capture complete change events.
- Initial snapshots of large tables can take hours and put load on the source database. Schedule initial snapshots during low-traffic periods.
- Kafka topic retention must outlast your downstream consumer lag. If consumers fall behind, they lose events when topics are compacted.
Questions fréquentes
The primary deployment uses Kafka Connect. However, Debezium Server provides a standalone runtime that can send events to Amazon Kinesis, Google Pub/Sub, Apache Pulsar, and other messaging systems without Kafka.
Debezium supports MySQL, PostgreSQL, MongoDB, SQL Server, Oracle, Db2, Cassandra, and Vitess. Each database has a dedicated connector that reads its specific transaction log format.
CDC reads the database transaction log to capture every change in order with sub-second latency. Polling queries the database on an interval, missing changes between polls and adding query load to the database.
Yes. Debezium tracks schema changes through the transaction log and records them in a schema history topic. Downstream consumers can detect when columns are added, removed, or modified.
Debezium stores its position in the transaction log in Kafka Connect offsets. When the connector restarts, it resumes from the last committed offset without missing or duplicating events.
Sources citées (3)
- Debezium GitHub— Debezium captures row-level changes from database transaction logs
- Debezium Documentation— Supports MySQL, PostgreSQL, MongoDB, SQL Server, Oracle, and more
- Debezium Tutorial— Kafka Connect architecture for declarative connector configuration
En lien sur TokRepo
Fil de discussion
Actifs similaires
Meteor — Full-Stack JavaScript Platform for Real-Time Web Apps
Meteor is an open-source full-stack JavaScript platform for building web and mobile applications with real-time data synchronization out of the box.
Graphite — Scalable Real-Time Graphing and Metrics Platform
Graphite is a time-series monitoring platform that stores numeric data and renders graphs on demand, providing a flexible API for querying, transforming, and visualizing operational metrics.
Apache Druid — Real-Time Analytics Database for Event-Driven Data
Apache Druid powers interactive analytics on real-time event data. With column-oriented storage, time-based partitioning, and a distributed architecture, it serves sub-second queries on trillions of events per day — the OLAP engine behind Netflix and Airbnb.
NSQ — Real-Time Distributed Messaging Platform in Go
A guide to NSQ, the real-time distributed messaging platform designed for fault tolerance and horizontal scalability with no single point of failure.