Reputation: 5738
I have a use case where I have to capture data change in the AWS RDS MySQL database via Kafka connect and publish it on a Kafka topic. For Kafka, I'm using AWS Managed Streaming for Apache Kafka (MSK) service. I have created the topic. I'm just left with the connector part so that the consumers can see the messages/events while consuming a topic.
My question is, how can I create a Kafka Connect connector to Monitor AWS RDS MySQL Database in AWS Managed Streaming for Apache Kafka (MSK) cluster?
I was following Tutorial for Debezium 0.9 to achieve this using Docker containers for Kafka and AWS RDS instance. I want to achieve this using AWS Managed Streaming for Apache Kafka (MSK) instead of Docker containers. I just want to use Docker containers on the consumer side only.
Is this even possible or do I have to go with either AWS ECS or AWS EKS?
Upvotes: 2
Views: 2425
Reputation: 5738
It is possible to create a Kafka Connect connector to monitor AWS RDS MySQL database by an AWS Managed Streaming for Apache Kafka (MSK) cluster by following the steps below:
binlog_format
should be set to ROW
on the AWS RDS MySQL database.SELECT
and REPLICATION CLIENT
.JAR
file from the Confluent Hub and then copy it under the plugin.path
directory in the Kafka Connect installation..properties
extension with appropriate properties. A sample configuration file is below:
name=<CONNECTOR_NAME>
connector.class=io.debezium.connector.mysql.MySqlConnector
database.hostname=<RDS_MYSQL_HOSTNAME>
database.port=<RDS_MYSQL_PORT>
database.user=<RDS_MYSQL_USERNAME>
database.password=<RDS MySQL password>
database.whitelist=<LIST_OF_DATABASES_TO_MONITOR>
database.server.id=1
database.server.name=<DB_SERVER_NAME>
database.history.kafka.bootstrap.servers=<KAFKA_BROKER_ENDPOINTS>
database.history.kafka.topic=<KAFA_TOPIC_NAME>
bin/connect-distributed.sh config/<CONNECTOR_CONFIGURATION_FILE_NAME>.properties
curl -X POST -H "Content-Type: application/json" --data @<CONNECTOR_CONFIGURATION_FILE_NAME>.properties http://localhost:8083/connectors
Note: This is a generic solution and you can change it according to your use case. Also, don't forget to replace the following placeholders: <CONNECTOR_CONFIGURATION_FILE_NAME>
, <CONNECTOR_NAME>
, <RDS_MYSQL_HOSTNAME>
, <RDS_MYSQL_PORT>
, <RDS_MYSQL_USERNAME>
, <RDS MySQL password>
, <LIST_OF_DATABASES_TO_MONITOR>
, <DB_SERVER_NAME>
, <KAFKA_BROKER_ENDPOINTS>
, and <KAFA_TOPIC_NAME>
before proceeding.
References:
Upvotes: 1