flume1.6 avro测试

来源:互联网 发布:org.apache.http包 编辑:程序博客网 时间:2024/05/29 19:34

首先安装flume这个就不用多说了。
其次编写avro的配置文件,这个可以从flume给的example.conf中去修改就行。
如下

# Name the components on this agenta1.sources = r1a1.sinks = k1a1.channels = c1# Describe/configure the sourcea1.sources.r1.type = avroa1.sources.r1.bind = localhosta1.sources.r1.port = 4141# Describe the sinka1.sinks.k1.type = logger# Use a channel which buffers events in memorya1.channels.c1.type = memorya1.channels.c1.capacity = 1000a1.channels.c1.transactionCapacity = 100# Bind the source and sink to the channela1.sources.r1.channels = c1a1.sinks.k1.channel = c1

这里的a1.sinks.k1.channel = c1注意是channel不是channels,一开始因为写错了这里,我迷茫了好久,输出的信息无法显示。不过仔细想一下channel是很正确的。

然后在测试

[user@master ~]# flume-ng avro-client -c <配置文件所在目录> -H <目标host> -p 4141 -F <随意一个文件>

显示如下:

2016-09-10 10:32:15,264 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.LoggerSink.process(LoggerSink.java:94)] Event: { headers:{} body: <此处为文件的内容> }
0 0
原创粉丝点击