110.1 演示环境介绍
- CM版本:5.13.1
- CDH版本:5.13.1
- MariaDB版本:5.5.56
- StreamSets版本:3.1.2.0
110.2 操作演示
1.环境布置
- 把MariaDB的Binlog日志开启
- 修改/etc/my.conf文件,在配置文件mysqld下增加如下配置:
- 建议使用Row模式的Binlog格式
- 修改/etc/my.conf文件,在配置文件mysqld下增加如下配置:
server-id=1
log-bin=mysql-bin
binlog_format=ROW
- 重启服务
[root@ip-168-31-16-68 ~]# systemctl restart mariadb
[root@ip-168-31-16-68 ~]# systemctl status mariadb
- 创建同步账号
GRANT ALL on maxwell.* to 'maxwell'@'%' identified by '123456';
GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE on *.* to 'maxwell'@'%';
FLUSH PRIVILEGES;
- 安装MySQL驱动在StreamSets中
- 把MySQL的JDBC驱动拷贝至/opt/cloudera/parcels/STREAMSETS_DATACOLLECTOR/streamsets-libs/streamsets-datacollector-mysql-binlog-lib/lib目录
- 把MySQL的JDBC驱动拷贝至/opt/cloudera/parcels/STREAMSETS_DATACOLLECTOR/streamsets-libs/streamsets-datacollector-mysql-binlog-lib/lib目录
- 创建测试表
create database test;
create table cdc_test (
id int,
name varchar(32)
);
- 创建Kudu表
create table cdc_test (
id int,
name String,
primary key(id)
)
PARTITION BY HASH PARTITIONS 16
STORED AS KUDU;