我有一个RabbitMQ队列,可以提取一些需要转移到弹性搜索的文档。
如何以消费者身份创建弹性搜索,以便ES将消费者作为文档队列的消费者。
可能的选择:
有人可以发布一个例子吗?
答案 0 :(得分:3)
在您的ELK创建配置文件/etc/logstash/conf.d/anyfile.conf
input {
rabbitmq {
host => 'rabbit.example.com'
queue => 'my_queue_name'
exchange => "my_exchange_name"
key => 'my_logs'
durable => true
}
}
output {
elasticsearch {
host => "elk.example.com"
}
}
答案 1 :(得分:0)
由于您要求RabbitMQ river,这里有一个示例,但您应该注意rivers will be deprecated soon(即ES 1.5)和Prameswar Lal使用Logstash的其他解决方案将是首选
curl -XPOST localhost:9200/_river/custom_river_name/_meta -d '{
"type" : "rabbitmq",
"rabbitmq" : {
"host" : "localhost",
"port" : 5672,
"user" : "guest",
"pass" : "guest",
"vhost" : "/",
"queue" : "elasticsearch",
"exchange" : "elasticsearch",
"routing_key" : "elasticsearch",
"exchange_declare" : true,
"exchange_type" : "direct",
"exchange_durable" : true,
"queue_declare" : true,
"queue_bind" : true,
"queue_durable" : true,
"queue_auto_delete" : false,
"heartbeat" : "30m",
"qos_prefetch_size" : 0,
"qos_prefetch_count" : 10,
"nack_errors" : true
},
"index" : {
"bulk_size" : 100,
"bulk_timeout" : "10ms",
"ordered" : false,
"replication" : "default"
}
}