$ docker-compose up
https://debezium.io/documentation/reference/1.9/connectors/mysql.html#enable-mysql-binlog
for MySql 5.x
mysql> SELECT variable_value as "BINARY LOGGING STATUS (log-bin) ::" FROM information_schema.global_variables WHERE variable_name='log_bin';
for MySql 8.x
mysql> SELECT variable_value as "BINARY LOGGING STATUS (log-bin) ::" FROM performance_schema.global_variables WHERE variable_name='log_bin';
If it is OFF, configure your MySQL server configuration file my.cnf
with the following properties, which are described below:
server-id = 223344
log_bin = mysql-bin
binlog_format = ROW
binlog_row_image = FULL
expire_logs_days = 10
Login As root
or Super Admin
$ mysql -u root -p
Grant the required permissions to the user user
in this example
mysql> GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'user' IDENTIFIED BY '123456';
mysql> FLUSH PRIVILEGES;
https://docs.confluent.io/platform/current/connect/references/restapi.html#kconnect-rest-interface
$ curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://127.0.0.1:8083/connectors/ -d @jdbc-sink-table-movie.json
$ curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://127.0.0.1:8083/connectors/ -d @jdbc-sink-table-person.json
$ curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" http://127.0.0.1:8083/connectors/ -d @mysql-source.json
mysql> INSERT INTO MOVIE(TITLE, DESCRIPTION) VALUES('Spiderman 2', 'good');
mysql> INSERT INTO MOVIE(TITLE, DESCRIPTION) VALUES('Spiderman 3', 'good');
debeziumtest=# SELECT * FROM "public"."mysqldbserver1_mydbMOVIE";
DESCRIPTION | created_at | TITLE | ID
-------------+----------------------+--------------------------------------------+----
good | 2023-03-06T14:11:18Z | Spiderman 2 | 1
good | 2023-03-06T15:32:54Z | Spiderman 3 | 2
(2 rows)
List topic
$ /bin/kafka-topics.sh --zookeeper zookeeper:2181 --list
Subscribe to topic
$ /bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic topic-name --from-beginning