尚硅谷大數(shù)據(jù)技術(shù)之Flume(新)第5章 Flume高級(jí)之自定義MySQLSource

5.5.3 MySql表準(zhǔn)備

1)?創(chuàng)建MySqlSource數(shù)據(jù)庫(kù)

CREATE DATABASE mysqlsource;

2) MySqlSource數(shù)據(jù)庫(kù)下創(chuàng)建數(shù)據(jù)表Student和元數(shù)據(jù)表Flume_meta

CREATE TABLE `student` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`name` varchar(255) NOT NULL,

PRIMARY KEY (`id`)

);

CREATE TABLE `flume_meta` (

`source_tab` varchar(255) NOT NULL,

`currentIndex` varchar(255) NOT NULL,

PRIMARY KEY (`source_tab`)

);

  • 向數(shù)據(jù)表中添加數(shù)據(jù)

1?zhangsan

2?lisi

3?wangwu

4?zhaoliu

5.5.4?測(cè)試并查看結(jié)果

  • 任務(wù)執(zhí)行

[atguigu@hadoop102 flume]$ bin/flume-ng agent --conf conf/ --name a1 \

--conf-file job/mysql.conf -Dflume.root.logger=INFO,console

  • 結(jié)果展示,如圖6-2所示:

圖6-2 結(jié)果展示