利用Eclipse对Flume进行远程调试分析环境搭建

准备工作:
1、到Flume官网下载apache-flume-1.8.0-bin.tar.gz
 
在Flume的conf目录新建一个RollingFileSink.conf文件
a1.sources = r1
a1.sinks = k1
a1.channels = c1
 
# 配置sources
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 6666
 
# 配置sink
a1.sinks.k1.type = com.flumeextend.RollingFileSink
a1.sinks.k1.sink.directory = G:\\apache-flume-1.8.0-bin\\RollingFileSinkTest
a1.sinks.k1.sink.rollInterval=0
a1.sinks.k1.sink.batchSize=100
a1.sinks.k1.sink.serializer=TEXT
a1.sinks.k1.sink.serializer.appendNewline = true
 
# 配置channel
a1.channels.c1.type = file
a1.channels.c1.checkpointDir = G:\\apache-flume-1.8.0-bin\\checkpoint
a1.channels.c1.dataDirs = G:\\apache-flume-1.8.0-bin\\data
 
# 将三者串联
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1
 
开启FLume远程调试:
在bin目录下的flume-ng.ps1文件,增加以下配置:
$JAVA_OPTS="-Xmx100m -Xdebug -Xrunjdwp:transport=dt_socket,address=8888,server=y,suspend=y"
 
 
打开CMD命令行,执行以下命令,启动Flume Agent:
cd G:\apache-flume-1.8.0-bin\bin
 
.\flume-ng.cmd agent --conf ../conf  --conf-file ../conf/RollingFileSink.conf --name a1 --property flume.root.logger=INFO,console
 
 
会出现:Listening for transport dt_socket at address: 8888
 
到Eclipse中开启flume远程调试:
 
打好断点:
 
点击Debug,就可以开始调试我们自己写的Flume插件了:
 
使用telnet给Flume发送一个event
 
新打开一个终端,输入命令:
telnet localhost 6666
 
 
在Eclipse中先打好断点:
 
 
输入Hello World,之后可以在Eclipse中打断点调试啦!
 

 

posted @ 2019-07-21 00:25  四叶草Grass  阅读(466)  评论(0编辑  收藏  举报