数据采集之解析Mysql的binlog日志发送至Kafka实时消费(转:https://blog.csdn.net/liguohuabigdata/article/details/79472777)
生活随笔
收集整理的這篇文章主要介紹了
数据采集之解析Mysql的binlog日志发送至Kafka实时消费(转:https://blog.csdn.net/liguohuabigdata/article/details/79472777)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文采用Maxwell來實現實時解析mysql的binlog日志發送至kafka
1、開啟mysql binlog
環境中mysql是docker容器,所以需要進入容器修改mysql配置.docker exec -it ef07dab4da9d bash然后進入/etc/mysql/ 修改my.cnf增加如下內容server-id=1log-bin=masterbinlog_format=row重啟docker容器 ,確認binlog是否開啟show variables like '%log_bin%';log_bin屬性值為ON,則以開啟成功2、配置并啟動Maxwell
Maxwell的 github地址為 https://github.com/zendesk/maxwell。可去下載最新版。 wget https://github.com/zendesk/maxwell/releases/download/v1.10.7/maxwell-1.10.7.tar.gz tar -zxf maxwell-1.10.7.tar.gz bin/maxwell --user='root' --password='123456'--host='10.99.22.24' --producer=kafka --kafka.bootstrap.servers=bigdata001:9092 host為 mysql地址,bigdata001是我機器地址3、啟動kafka
我這里kafka是已經安裝好的,直接啟動就可以了,如果沒有可以按照官網的步驟安裝kafka,啟動kafka之前先要啟動 zookeeper bin/zkServer.sh start 然后開啟kafka bin/kafka-server-start.sh config/server.properties 創建topic bin/kafka-topics.sh--create --zookeeper bigdata001:2181 --replication-factor 1 --partitions 1 --topic maxwell 啟動producer bin/kafka-console-producer.sh--broker-list bigdata001:9092 --topic maxwell 啟動consumerbin/kafka-console-consumer.sh--zookeeper bigdata001:2181 --topic maxwell --from-beginning4、測試
改變數據庫可看到如下效果
其它方案(非博文中的內容):
https://blog.csdn.net/qq_30921461/article/details/78320750
總結
以上是生活随笔為你收集整理的数据采集之解析Mysql的binlog日志发送至Kafka实时消费(转:https://blog.csdn.net/liguohuabigdata/article/details/79472777)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 信用卡提升额度技巧
- 下一篇: 助学贷款审核通过后啥时候放款