mysql环境准备
开启binlog
1 | [mysqld] |
创建账号
1 | MariaDB [(none)]> create user 'deb'@'%' identified by 'deb'; |
debezium
下载debezium
安装在1191
wget https://repo1.maven.org/maven2/io/debezium/debezium-connector-mysql/1.0.0.Final/debezium-connector-mysql-1.0.0.Final-plugin.tar.gz
安装debezium
安装在1191
2
3
4
5
6[root@cloudsc ~]# tar -xzvf debezium-connector-mysql-1.0.0.Final-plugin.tar.gz
[root@cloudsc ~]# mv debezium-connector-mysql /usr/local/
##[root@cloudsc ~]# vi .bash_profile
##export CLASSPATH=/usr/local/debezium-connector-mysql/debezium-core-1.0.0.Final.jar:.
##[root@cloudsc ~]# source .bash_profile
connect
配置文件并启动
登录119执行1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50[root@cloudsc ~]# cd /usr/local/debezium-connector-mysql/
[root@cloudsc debezium-connector-mysql]# ls
antlr4-runtime-4.7.2.jar CONTRIBUTE.md debezium-connector-mysql-1.0.0.Final.jar debezium-ddl-parser-1.0.0.Final.jar LICENSE.txt mysql-connector-java-8.0.16.jar
CHANGELOG.md COPYRIGHT.txt debezium-core-1.0.0.Final.jar LICENSE-3rd-PARTIES.txt mysql-binlog-connector-java-0.19.1.jar README.md
##[root@cloudsc debezium-connector-mysql]# vi mysql.prop
{
"name": "mariadb-connector",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "192.168.106.128",
"database.port": "3306",
"database.user": "deb",
"database.password": "deb",
"database.server.id": "184054",
"database.server.name": "mariadbdata",
"database.whitelist": "deb",
"database.history.kafka.bootstrap.servers": "192.168.106.117:9092,192.168.106.118:9092,192.168.106.119:9092",
"database.history.kafka.topic": "dbhistory.deb",
"column.blacklist": "deb.tb_test.b",
"include.schema.changes": "false"
}
}
[root@cloudsb debezium-connector-mysql]# cd ../kafka_2.12-2.1.1/
[root@cloudsb debezium-connector-mysql]# cp mysql-connector-java-8.0.16.jar ../kafka_2.12-2.1.1/libs/
[root@cloudsb debezium-connector-mysql]# cp *.jar ../kafka_2.12-2.1.1/libs/
##[root@cloudsb kafka_2.12-2.1.1]# vi config/connect-standalone.properties
##plugin.path=/usr/local/debezium-connector-mysql
##[root@cloudsb kafka_2.12-2.1.1]# bin/connect-standalone.sh config/connect-standalone.properties ../debezium-connector-mysql/mysql.prop 报错
[root@cloudsb kafka_2.12-2.1.1]# bin/connect-distributed.sh config/connect-distributed.properties
[root@cloudsb kafka_2.12-2.1.1]# curl -s -X POST -H "Content-Type: application/json" --data \
'{
"name": "mariadb-connector",
"config": {
"connector.class": "io.debezium.connector.mysql.MySqlConnector",
"tasks.max": "1",
"database.hostname": "192.168.106.128",
"database.port": "3306",
"database.user": "deb",
"database.password": "deb",
"database.server.id": "184054",
"database.server.name": "mariadbdata",
"database.whitelist": "deb",
"database.history.kafka.bootstrap.servers": "192.168.106.117:9092,192.168.106.118:9092,192.168.106.119:9092",
"database.history.kafka.topic": "dbhistory.deb",
"column.blacklist": "deb.tb_test.b",
"include.schema.changes": "false"
}
}' \
http://localhost:8083/connectors
使用
1 | [root@cloudsb debezium-connector-mysql]# curl localhost:8083/connector-plugins |