Flume1.7源码调试

下载源码

git clone https://github.com/apache/flume.git

将源码导入Idea

编译时会有以下jar仓库中无法找到并下载,需要手动下载到本地仓库

1
linq4j-0.4.jar  pentaho-aggdesigner-algorithm-5.1.3-jhyde.jar  quidem-0.1.1.jar

以上jar文件可以在下面的网站中找到

1
2
http://conjars.org/repo/
http://repository.pentaho.org/artifactory/repo/

执行下面的命令将jar下载到本地仓库

1
2
3
mvn install:install-file -Dfile=pentaho-aggdesigner-algorithm-5.1.3-jhyde.jar -DgroupId=org.pentaho -DartifactId=pentaho-aggdesigner-algorithm -Dversion=5.1.3-jhyde -Dpackaging=jar
mvn install:install-file -Dfile=linq4j-0.4.jar -DgroupId=net.hydromatic -DartifactId=linq4j -Dversion=0.4 -Dpackaging=jar
mvn install:install-file -Dfile=quidem-0.1.1.jar -DgroupId=net.hydromatic -DartifactId=quidem -Dversion=0.1.1 -Dpackaging=jar

执行编译命令

1
mvn clean install -DskipTests

本地调试

1
2
主类:org.apache.flume.node.Application
参数:-n agent -f /home/liby/local/apache-flume-1.7.0-bin/conf/flume-conf.properties

flume-conf.properties

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Name the components on this agent
agent.sources = r1
agent.sinks = k1
agent.channels = c1
# Describe/configure the source
agent.sources.r1.type = netcat
agent.sources.r1.bind = localhost
agent.sources.r1.port = 44445
# Describe the sink
# 将数据输出至日志中
agent.sinks.k1.type = logger
# Use a channel which buffers events in memory
agent.channels.c1.type = memory
agent.channels.c1.capacity = 1000
agent.channels.c1.transactionCapacity = 100
# Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

运行效果

远程调试

在conf/flume-env.properties增加以下配置,然后启动flume

1
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

在idea中启动远程调试

欢迎关注我的微信公众号,订阅最新文章!
🐶 您的支持将鼓励我继续创作 🐶
0%