14 Mayıs 2023 Pazar

Debezium Connector Json Çıktı

Örnek
Şöyledir. Update işlemi
{
    "_index": "ecommerce-cdc.ecommerce.product",
    "_id": "4a7f1ebe-ece2-11ed-9bc5-0242ac120003",
    "_version": 6,
    "_seq_no": 2,
    "_primary_term": 1,
    "found": true,
    "_source": {
        "before": {
            "id": "4a7f1ebe-ece2-11ed-9bc5-0242ac120003",
            "brand": "Coca-Cola",
            "category": "Drinks/Fizzy Drinks",
            "name": "Coca-Cola Zero Sugar 24 x 330ml",
            "price": 10
        },
        "after": {
            "id": "4a7f1ebe-ece2-11ed-9bc5-0242ac120003",
            "brand": "Coca-Cola",
            "category": "Drinks/Fizzy Drinks",
            "name": "Coca-Cola Zero Sugar 24 x 330ml",
            "price": 20
        },
        "source": {
            "version": "2.0.0.Final",
            "connector": "mysql",
            "name": "ecommerce-cdc",
            "ts_ms": 1683472083000,
            "snapshot": "false",
            "db": "ecommerce",
            "sequence": null,
            "table": "product",
            "server_id": 1,
            "gtid": null,
            "file": "binlog.000002",
            "pos": 399,
            "row": 0,
            "thread": 60,
            "query": null
        },
        "op": "u",
        "ts_ms": 1683472083922,
        "transaction": null
    }
}


Debezium Kullanımı İçin Hazırlık

1. User ve Role Yaratılır
Şöyle yaparız
CREATE USER 'debezium'@'localhost' IDENTIFIED BY 'passme';
CREATE USER 'debezium'@'%' IDENTIFIED BY 'passme';

GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* 
TO 'debezium'@'localhost';
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* 
TO 'debezium'@'%';
2. /etc/mysql/my.cnf
Şöyle yaparız
[mysqld]
log-bin=mysql-bin
binlog-format=ROW
server-id=1
3. Kafka'ya Kurulum
Şöyle yaparız
# download the connector
curl https://repo1.maven.org/maven2/io/debezium/debezium-connector-mysql/1.5.0.Final/debezium-connector-mysql-1.5.0.Final-plugin.tar.gz | tar xvz

# Copy the connector files to the Kafka plugin directory.
cp debezium-connector-mysql/debezium-connector-mysql-1.5.0.Final.jar /usr/local/s

Soft Delete

Giriş Açıklaması  şöyle When using the soft delete mechanism on the database, you might run into a situation where a record with a unique co...