老师,我想把一个机器上的日志抓取到另一台机器,但是两台链接不成功。
从一台机器监听一个文件,将新产生的文件,传输到另一个机器
agent选型:
exec-source +memory channel + avro-sink
avro source +memory channel + hdfs sink
第一个配置文件
#exec-memory-avro.conf
spider001.sources = exec-source
spider001.sinks = avro-sink
spider001.channels = memory-channel
spider001.sources.exec-source.type = exec
spider001.sources.exec-source.command=tail -f /home/hadoop/data/liepin_2019-01-08.json
spider001.sources.exec-source.shell = /bin/sh -c
spider001.sinks.avro-sink.type = avro
spider001.sinks.avro-sink.hostname = 192.168.1.105
spider001.sinks.avro-sink.port = 41414
spider001.channels.memory-channel.type = memory
spider001.sources.exec-source.channels = memory-channel
spider001.sinks.avro-sink.channel = memory-channel
第二个配置文件
#avro-memory-hdfs.conf
hadoopOne.sources = spider001-source
hadoopOne.sinks = hdfs-sink
hadoopOne.channels = memory-channel
hadoopOne.sources.spider001-source.type = avro
hadoopOne.sources.spider001-source.bind=192.168.1.106
hadoopOne.sources.spider001-source.port = 41414
hadoopOne.sinks.hdfs-sink.type = hdfs
hadoopOne.sinks.hdfs-sink.hdfs.path =hdfs://192.168.1.105:9000/flume
hadoopOne.sinks.hdfs-sink.hdfs.rollInterval= 0
hadoopOne.sinks.hdfs-sink.hdfs.rollSize = 131072
hadoopOne.sinks.hdfs-sink.hdfs.fileType=DataStream
hadoopOne.channels.memory-channel.type = memory
hadoopOne.sources.spider001-source.channels = memory-channel
hadoopOne.sinks.hdfs-sink.channel = memory-channel
启动
flume-ng agent -n hadoopOne --conf $FLUM_HOME/conf -f $FLUM_HOME/conf/hadoopOne.conf -Dflume.root.logger=INFO,console
flume-ng agent -n spider001 --conf $FLUM_HOME/conf -f $FLUM_HOME/conf/spider001.conf -Dflume.root.logger=INFO,console
启动hadoopOne 的,会报错无法注册
org.jboss.netty.channel.ChannelException: Failed to bind to: /192.168.1.106:41414
Caused by: java.net.BindException: Cannot assign requested address
启动spider001(数据源)
2019-01-14 09:14:36,021 (lifecycleSupervisor-1-2) [WARN - org.apache.flume.sink.AbstractRpcSink.start(AbstractRpcSink.java:294)] Unable to create Rpc client using hostname: 192.168.1.107, port: 41414
org.apache.flume.FlumeException: NettyAvroRpcClient { host: 192.168.1.105, port: 41414 }: RPC connection error
Caused by: java.io.IOException: Error connecting to /192.168.1.105:41414