1.创建Maven工程
2.编写所需要自定义组件的代码(以Source为例),打包放到服务器上
3.添加idea Debug 配置
4.在服务器上广播Debug端口
[atguigu@hadoop102 flume]$ export FLUME_JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"
提示:这里需要将suspend=n,改为suspend=y.
5.启动Flume 程序,测试连接
[atguigu@hadoop102 flume ]$ flume-ng agent -c conf/ -f jobs/mysource.conf -n a1 -Dflume.root.logger=INFO,console
6.进入Idea 进行Debug操作
7.取消端口的广播
[atguigu@hadoop102 flume]$ export -n FLUME_JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"