首页 > 数据库 > Oracle > 正文

Flume监听oracle表增量的步骤详解

2020-07-26 14:00:45
字体:
来源:转载
供稿:网友

需求:获取oracle表增量信息,发送至udp514端口,支持ip配置

步骤:

(1)需要的jar  oracle的 odbc5.jar(oracle安装目录  /jdbc/lib下查找)

(2)flume的开源包flume-ng-sql-source-1.4.3.jar  最新的好像是1.5的 小版本记不住了 这个下载地址直接csdn上就有

这两个jar 都拷贝到flume的lib下

(3)flume配置文件

a1.sources = r1a1.sinks = k1a1.channels = c1#接收syslog配置#a1.sources.r1.type = syslogudp#a1.sources.r1.port = 514#a1.sources.r1.host = 0.0.0.0###########sql source#################a1.sources.r1.type = org.keedio.flume.source.SQLSourcea1.sources.r1.hibernate.connection.url = jdbc:oracle:thin:@10.9.224.36:1521/soc# Hibernate Database connection propertiesa1.sources.r1.hibernate.connection.user = soc_appa1.sources.r1.hibernate.connection.password = soc_appa1.sources.r1.hibernate.connection.autocommit = truea1.sources.r1.hibernate.dialect = org.hibernate.dialect.Oracle10gDialecta1.sources.r1.hibernate.connection.driver_class = oracle.jdbc.driver.OracleDrivera1.sources.r1.run.query.delay=1a1.sources.r1.status.file.path = /usr/local/flumea1.sources.r1.status.file.name = a1.sqlSource.status# Custom querya1.sources.r1.start.from = '2017-07-31 07:06:20'a1.sources.r1.custom.query = SELECT CHR(39)||TO_CHAR(CREATETIME,'YYYY-MM-DD HH24:MI:SS')||CHR(39),MSG FROM FLUME_NG_SQL_SOURCE WHERE CREATETIME > TO_DATE($@$,'YYYY-MM-DD HH24:MI:SS') ORDER BY CREATETIME ASCa1.sources.r1.batch.size = 6000a1.sources.r1.max.rows = 1000a1.sources.r1.hibernate.connection.provider_class = org.hibernate.connection.C3P0ConnectionProvidera1.sources.r1.hibernate.c3p0.min_size=1a1.sources.r1.hibernate.c3p0.max_size=10###########sql source##################自定义类型a1.sinks.k1.type = com.neusoft.utils.SyslogSink#配置发送ipa1.sinks.k1.destination = 10.9.224.36a1.channels.c1.type = memorya1.channels.c1.capacity = 10000a1.channels.c1.transactionCapacity = 10000a1.sources.r1.channels = c1a1.sinks.k1.channel = c1#启动命令 ./flume-ng agent -c ../conf -f ../conf/flume-sql.conf -n a1 -Dflume.root.logger=INFO,console &

由于是自己定义的sink 在我的博客中也有提到,所以配置了自定义的sink。

总结

以上所述是小编给大家介绍的Flume监听oracle表增量的步骤详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对武林网网站的支持!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表