添加Apache flume弹性搜索接收器

时间:2017-03-08 16:33:16

标签: fiware fiware-cygnus

我想在天鹅座中使用Apache flume Elastic search native sink。 如何配置cygnus使用此原生接收器?

我是否将本地jar file放入Apache flume lib并将代理配置如下:

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

然后我为cygnus-ngsi代理开始两个cygnus实例一,而另一个用于弹性搜索本机接收器? 无法找到如何运行cygnus实例(我从源代码安装了cygnus,因此我无法使用linux服务启动它)

是否有可能为cygnus-ngsi和这个新水槽使用相同的来源?因为我需要两个相同的来源。

谢谢和最诚挚的问候。

1 个答案:

答案 0 :(得分:1)

Cygnus基于Apache Flume,它安装了所有Flume库。这意味着如果你愿意,你甚至可以使用Cygnus作为纯Flume代理。换句话说,Cygnus是Apache Flume的扩展。

因此,在Cygnus中使用原生接收器只是配置问题。在ElasticSearchSink的特定情况下,只需按照documentation

cygnusngsi.sinks = elastic-sink <other_flume_sinks> <other_cygnus_sinks>
cygnusngsi.channels = elastic-channel <other_channels>
...
cygnusngsi.sinks.elastic-sink.type = elasticsearch
cygnusngsi.sinks.elastic-sink.hostNames = 127.0.0.1:9200,127.0.0.2:9300
cygnusngsi.sinks.elastic-sink.indexName = foo_index
cygnusngsi.sinks.elastic-sink.indexType = bar_type
cygnusngsi.sinks.elastic-sink.clusterName = foobar_cluster
cygnusngsi.sinks.elastic-sink.batchSize = 500
cygnusngsi.sinks.elastic-sink.ttl = 5d
cygnusngsi.sinks.elastic-sink.serializer = org.apache.flume.sink.elasticsearch.ElasticSearchDynamicSerializer
cygnusngsi.sinks.elastic-sink.channel = elastic-channel

关于源,您可以在单个代理配置中配置多个,然后通过专用通道将每个源连接到不同的接收器。示意性地:

source1 --- channel1 --- sink1
source2 --- channel2 --- sink2

或者你可以为两个接收器使用相同的源;在这种情况下,您必须通过两个专用通道将两个接收器连接到单个源,并且复制通道选择器(无需配置它,这是默认行为)将创建传入NGSI通知的副本每个频道。示意性地:

          ___ channel1 --- sink1
source__ /
         \___ channel2 --- sink2