如何使用flume将数据从一个系统传输到另一个系统的hdfs(通过局域网连接)?

mbzjlibv  于 2021-06-03  发布在  Flume
关注(0)|答案(1)|浏览(324)

我有一台局域网连接的电脑。我需要使用flume将数据从系统传输到另一个系统的hdfs位置。
我试过使用接收器系统的ip地址,但没用。请帮忙。。
当做,
阿提拉姆

0s0u357o

0s0u357o1#

这可以通过使用avro机制来实现。
Flume必须安装在两台机器上。必须使包含以下代码的配置文件在生成日志的源系统中运行。

a1.sources = tail-file
a1.channels = c1
a1.sinks=avro-sink

a1.sources.tail-file.channels = c1
a1.sinks.avro-sink.channel = c1
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000

a1.sources.tail-file.type = spooldir
a1.sources.tail-file.spoolDir =<location of spool directory>
a1.sources.tail-file.channels = c1
a1.sinks.avro-sink.type = avro
a1.sinks.avro-sink.hostname = <IP Address of destination system where the data has to    be written>   
a1.sinks.avro-sink.port = 11111

必须使包含以下代码的配置文件在生成日志的目标系统中运行。

a2.sources = avro-collection-source
a2.sinks = hdfs-sink
a2.channels = mem-channel

a2.sources.avro-collection-source.channels = mem-channel
a2.sinks.hdfs-sink.channel = mem-channel
a2.channels.mem-channel.type = memory
a2.channels.mem-channel.capacity = 1000

a2.sources.avro-collection-source.type = avro
a2.sources.avro-collection-source.bind = localhost
a2.sources.avro-collection-source.port = 44444

a2.sinks.hdfs-sink.type = hdfs
a2.sinks.hdfs-sink.hdfs.writeFormat = Text
a2.sinks.hdfs-sink.hdfs.filePrefix =  testing
a2.sinks.hdfs-sink.hdfs.path = hdfs://localhost:54310/user/hduser/

现在,源系统中的日志文件中的数据将写入目标系统中的hdfs系统。
当做,
阿提拉姆

相关问题