Skip to content

psalias2006/kafka-to-mySql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kafka-to-MySQL Connector

Kafka-to-MySQL Connector is a Python application that consumes kafka events and record them in a MySQL database. Kafka workers are isolated in docker containers under the same consumer group and use a Zookeeper instance to self balance the consumption procedure.

enter image description here

Prepare the MySQL Database

MySql scripts directory

kafka-to-mySql/SqlScript/ 

Installation

$ vim kafkaConsumer/kafkaBalancedConsumer/consumer.conf
[kafka]
Host = 1.1.1.1:9092
Topic = data
Batch = 10

[zoo]
Host = some-zoo:2181
ConsumerGroup = testgroup_11

[mysql]
Host = 1.1.1.1
Schema = some-schema
User = root
Pass = some-password
Table = some-table
$ docker run --name some-zookeeper --restart always -d zookeeper
  • Build the kafka-to-MySQL container
$ cd kafka-to-mySql/Docker
$ ./buildme.sh 
  • Start a kafka worker
$ docker run --name kafka-worker_1 -d kafka_to_sql_connector

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT