添加 Apache flume 弹性搜索接收器
adding Apache flume elastic search sink
我想在 cygnus 中使用 Apache flume Elastic search native sink。
如何配置 cygnus 以使用此原生接收器?
我是否将本机 jar file 放入 Apache flume 库并将代理配置为以下内容:
# 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 实例,一个用于 cygnus-ngsi 代理,另一个用于弹性搜索本机接收器?
找不到如何 运行 cygnus 实例(我从源安装了 cygnus,所以我不能使用 linux 服务来启动它)
是否可以为 cygnus-ngsi 和这个新接收器使用相同的源?因为我需要相同的来源。
谢谢并致以最诚挚的问候。
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
我想在 cygnus 中使用 Apache flume Elastic search native sink。 如何配置 cygnus 以使用此原生接收器?
我是否将本机 jar file 放入 Apache flume 库并将代理配置为以下内容:
# 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 实例,一个用于 cygnus-ngsi 代理,另一个用于弹性搜索本机接收器? 找不到如何 运行 cygnus 实例(我从源安装了 cygnus,所以我不能使用 linux 服务来启动它)
是否可以为 cygnus-ngsi 和这个新接收器使用相同的源?因为我需要相同的来源。
谢谢并致以最诚挚的问候。
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