Login to Openshift CLI and create new project
$ oc login
$ oc new-project erfin-debezium
Deploy mysql database from debezium's example
$ oc new-app docker.io/debezium/example-mysql:0.5 \
-e MYSQL_ROOT_PASSWORD=debezium \
-e MYSQL_USER=mysqluser \
-e MYSQL_PASSWORD=mysqlpw
This steps need cluster-admin role to install Strimzi Operator to your namespace (erfin-debezium)
Install strimzi Connect s2i
Expose route Kafka connect api to register database's cdc listener later
$ oc expose svc/my-connect-cluster-connect-api
$ oc get route
result
NAME HOST/PORT
my-connect-cluster-connect-api my-connect-cluster-connect-api-erfin-debezium.apps.erfin-cluster.sandbox1459.opentlc.com
$ mkdir plugins
$ cd plugins
$ wget https://repo1.maven.org/maven2/io/debezium/debezium-connector-mysql/1.1.2.Final/debezium-connector-mysql-1.1.2.Final-plugin.tar.gz
$ tar -xzf debezium-connector-mysql-1.1.2.Final-plugin.tar.gz
Structure will be like this
$HOME/plugins
-|
|-debezium-connector-mysql
|- ...
|- debezium-connector-mysql-1.1.2.Final.jar
|- ...
$ oc start-build my-connect-cluster-connect --from-dir $HOME/plugins/
$ oc get route
$ curl -i -X POST \
-H "Accept:application/json" \
-H "Content-Type:application/json" \
http://my-connect-cluster-connect-api-erfin-debezium.apps.erfin-cluster.sandbox1459.opentlc.com/connectors \
-d \
'{ "name": "inventory-connector", \
"config": { \
"connector.class": "io.debezium.connector.mysql.MySqlConnector", \
"tasks.max": "1", \
"database.hostname": "example-mysql", \
"database.port": "3306", \
"database.user": "debezium", \
"database.password": "dbz", \
"database.server.id": "184054", \
"database.server.name": "dbserver1", \
"database.whitelist": "inventory", \
"database.history.kafka.bootstrap.servers": "my-cluster-kafka-brokers:9092", \
"database.history.kafka.topic": "dbhistory.inventory" } }'
Result if success
201Created
Or use Postman for simpler use :)
Deploy kafka client apps using Knative. Note: this application use quarkus with smallrye kafka client on my Quay.io registry :)
$ oc new-app quay.io/efeluzy/quarkus-kafka-consumer:latest \
-e mp.messaging.incoming.mytopic-subscriber.topic=dbserver1.inventory.customers \
$ curl http://quarkus-kafka-consumer-erfin-debezium.apps.erfin-cluster.sandbox1459.opentlc.com/stream
$ kn service update quarkus-kafka-consumer \
--image quay.io/efeluzy/quarkus-kafka-consumer:latest \
--revision-name quarkus-kafka-consumer-v4 \
--env mp.messaging.incoming.mytopic-subscriber.topic=dbserver1.inventory.customers
$ kn route list
$ curl http://quarkus-kafka-consumer-erfin-debezium.apps.erfin-cluster.sandbox1459.opentlc.com/stream