You can use the Debezium Change Data Capture (CDC) connector to stream changes in real-time from MySQL, PostgreSQL, Oracle, Db2 and feed data to Kafka, JDBC, the Webhook sink or Materialized Views using SQL Stream Builder (SSB).
Concept of Change Data Capture
Change Data Capture (CDC) is a process to capture changes in a source system, and update the data within a downstream system or application with the changes.
The Debezium implementation offers CDC with database connectors from which real-time events are updated using Kafka and Kafka Connect. Debezium captures every row-level change in each database table of an event stream. Applications read these streams to see the change events in the same order as they occurred. The change events are routed to a Kafka topic from which Kafka Connect feeds the records to other systems and databases.
For more information about Debezium, see the official Debezium documentation.
From the supported set of Debezium connectors, MySQL, PostgreSQL, Oracle and Db2 are supported in Cloudera Streaming Analytics.
Using the CDC connectors
You can access and import the templates of the CDC connectors from Streaming SQL Console:
- Navigate to the Streaming SQL Console.
- Go to your cluster in Cloudera Manager.
- Click on SQL Stream Builder from the list of Services.
- Click on the SQLStreamBuilder Console.
The Streaming SQL Console opens in a new window.
- Select Console from the main menu.
- Click Templates under the SQL window.
- Select one of the CDC templates you want to use.
The template is imported to the SQL window.
- Provide information to the mandatory fields of the template.
- Click Execute.
Using Db2 CDC connector
CREATE TABLE db2_cdc_source ( 'column_name' INT, 'column_name' STRING ) WITH ( 'connector' = 'db2-cdc', 'hostname' = '...', 'port' = '...', 'username' = '...', 'password' = '...', 'database-name' = '...', 'schema-name' = '...', 'table-name' = '...' )