三、BinLog與Kafka的良配(maxwell組件)

一、Zookeeper

1.1、下載zk

wget http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz
tar -zxvf zookeeper-3.4.10.tar.gz 
三、BinLog與Kafka的良配(maxwell組件)

1.2、制定配置文件

cd zookeeper-3.4.10/conf
cp zoo_sample.cfg zoo.cfg
三、BinLog與Kafka的良配(maxwell組件)

1.3、啟動zk

./zkServer.sh start
三、BinLog與Kafka的良配(maxwell組件)

二、Kafka

2.1、下載Kafka

wget http://mirror.bit.edu.cn/apache/kafka/2.1.0/kafka_2.12-2.1.0.tgz
tar -zxvf kafka_2

2.2、啟動Kafka

bin/kafka-server-start.sh config/server.properties
三、BinLog與Kafka的良配(maxwell組件)

2.3、制定Kafka內存、並且啟動Kafka

三、BinLog與Kafka的良配(maxwell組件)

2.4、創建一個為“maxwell“的topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic maxwell
三、BinLog與Kafka的良配(maxwell組件)

三、Maxwell組件

3.1、下載maxwell組件

wget https://github.com/zendesk/maxwell/releases/download/v1.10.7/maxwell-1.10.7.tar.gz 
tar -zxvf maxwell-1.10.7.tar.gz 

三、BinLog與Kafka的良配(maxwell組件)

四、更新數據庫權限

4.1、給數據庫新增用戶名/密碼均為maxwell的權限

GRANT ALL on maxwell.* to'maxwell'@'%' identified by 'maxwell';

GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE on *.* to 'maxwell'@'%';

flush privileges;

三、BinLog與Kafka的良配(maxwell組件)

4.2、啟動maxwell

bin/maxwell --user='maxwell' --password='maxwell' --host='127.0.0.1'
三、BinLog與Kafka的良配(maxwell組件)

五、實踐

修改表中的數據

三、BinLog與Kafka的良配(maxwell組件)

然後看到maxwell的日誌

三、BinLog與Kafka的良配(maxwell組件)

三、BinLog與Kafka的良配(maxwell組件)


分享到:


相關文章: