实操背景:其实很简单,就是想要使用 Avro Source ,在 master 上启动 Flume 的 Agent ,然后让 slave1 节点发送信息过来,让 master 采集到。
有小伙伴报了以下错误:
org.apache.flume.FlumeException: Failed to set up server socket
at org.apache.flume.source.AvroSource.start(AvroSource.java:248)
at org.apache.flume.source.EventDrivenSourceRunner.start(EventDrivenSourceRunner.java:44)
at org.apache.flume.lifecycle.LifecycleSupervisor$MonitorRunnable.run(LifecycleSupervisor.java:249)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.netty.channel.ChannelException: Failed to bind to: /192.168.128.132:4141
at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:272)
at org.apache.avro.ipc.NettyServer.<init>(NettyServer.java:106)
at org.apache.flume.source.AvroSource.start(AvroSource.java:243)
... 9 more
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)

打开 slave1
启动 avro-client ,报错如下:
22/02/25 16:31:26 WARN api.NettyAvroRpcClient: Using default maxIOWorkers
22/02/25 16:31:26 ERROR avro.AvroCLIClient: Unable to open connection to Flume. Exception follows.
org.apache.flume.FlumeException: NettyAvroRpcClient { host: master, port: 4141 }: RPC connection error
at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:181)
at org.apache.flume.api.NettyAvroRpcClient.connect(NettyAvroRpcClient.java:120)
at org.apache.flume.api.NettyAvroRpcClient.configure(NettyAvroRpcClient.java:638)
解决办法:
1、检查 master 的配置,ip地址和端口是否配置错了,应该配的是监听自己 master 的ip地址和端口。
2、先启动Agent,再启动 avro-client 就可以了。
就这样,完美解决,Nice!!!










