flink+streampark需要的包

1、streampark-jdbc

flink-connector-jdbc-1.16.3.jar

2、mysql-cdc

flink-connector-mysql-cdc、flink-sql-connector-mysql-cdc

3、elasticsearch

flink-sql-connector-elasticsearch7、elasticsearch

4、sql示例

CREATE TABLE IF NOT EXISTS source_t_wechat_mp(

  `id` bigint NOT NULL,

  `fakeid` STRING NULL,

  `aid` STRING NULL,

  `digest` STRING NULL,

  `link` STRING NULL,

  `title` STRING NULL,

  `is_full` STRING NULL,

  `update_time` BIGINT NULL,

  `created_time` Timestamp NOT NULL,  

  PRIMARY KEY (`id`)  NOT ENFORCED

  ) with (

       'connector' = 'mysql-cdc',

       'hostname' = '172.17.66.151',

       'port' = '3306',

       'database-name' = 'netspider',

       'username' = 'sitdbuser',

       'password' = 'Topsperity31@sit',

       'table-name' = 't_wechat_mp',

   'scan.startup.mode' = 'initial',

       'jdbc.properties.useSSL' = 'false'

      );

CREATE TABLE IF NOT EXISTS source_t_wechat_mp_article (

  `id` bigint NOT NULL,

  `fakeid` STRING NULL ,

  `mp_id` int  NULL ,

  `article_content` STRING ,

  `created_time` Timestamp ,

  PRIMARY KEY (`id`) NOT ENFORCED

  ) with (

       'connector' = 'mysql-cdc',

       'hostname' = '172.17.66.151',

       'port' = '3306',

       'database-name' = 'netspider',

       'username' = 'sitdbuser',

       'password' = 'Topsperity31@sit',

       'table-name' = 't_wechat_mp_article',

       'scan.startup.mode' = 'initial',

       'jdbc.properties.useSSL' = 'false'

      );

 CREATE TABLE IF NOT EXISTS index_article_details_wechat(

  dataSource STRING,

  bizNo STRING,

  newsId STRING,

  title STRING,

  brief STRING,

  status STRING,

  content STRING,

  newsPubOrg STRING,

  author STRING,

  pubDate bigint,

  createdTime Timestamp,

  link STRING ,

  PRIMARY KEY (`bizNo`)  NOT ENFORCED ) WITH (

  'connector' = 'elasticsearch-7',

  'hosts' = 'http://172.17.66.169:9200',

  'username'='tebon',

  'password'='Tebon@p123!',

  'index' = 'index_article_details_wechat',

 'sink.bulk-flush.backoff.strategy' = 'EXPONENTIAL');

     

 insert into index_article_details_wechat(dataSource, bizNo, newsId,title,brief ,status,content,newsPubOrg,author,pubDate,createdTime,link)

 select 'qsgzh',m.aid,m.aid,m.title,m.digest,'1', a.article_content,'券商公众号','券商公众号', CAST(concat(CAST(m.update_time as String),CAST('000' as String)) as Bigint), m.created_time,m.link

from source_t_wechat_mp m INNER JOIN source_t_wechat_mp_article a on a.mp_id = m.id;

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值