日志存储对我来说是100%的灾难。我在同一台机器上使用LS 1.4.1和ES 1.02。
以下是我启动logstash索引器的方法:
/usr/local/share/logstash-1.4.1/bin/logstash -f /usr/local/share/logstash.indexer.config
input {
redis {
host => "redis.queue.do.development.sf.test.com"
data_type => "list"
key => "logstash"
codec => json
}
}
output {
stdout { }
elasticsearch {
bind_host => "127.0.0.1"
port => "9300"
}
}
ES我设置:
network.bind_host: 127.0.0.1
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
哇......这就是我得到的:
/usr/local/share/logstash-1.4.1/bin/logstash -f /usr/local/share/logstash.indexer.config
Using milestone 2 input plugin 'redis'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.4.1/plugin-milestones {:level=>:warn}
log4j, [2014-05-29T12:02:29.545] WARN: org.elasticsearch.discovery: [logstash-do-logstash-sf-development-20140527082230-866-2010] waited for 30s and no initial state was set by the discovery
Exception in thread ">output" org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s]
at org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java:180)
at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(org/elasticsearch/cluster/service/InternalClusterService.java:492)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java/util/concurrent/ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java/util/concurrent/ThreadPoolExecutor.java:615)
at java.lang.Thread.run(java/lang/Thread.java:744)
答案 0 :(得分:20)
请参阅http://logstash.net/docs/1.4.1/outputs/elasticsearch
版本注意:您的Elasticsearch集群必须运行Elasticsearch 1.1.1。如果您使用任何其他版本的Elasticsearch,则应设置protocol =>这个插件中的http。
因此,您的问题是,logstash不支持您使用的旧ES版本,而不使用http
传输。
答案 1 :(得分:6)
设置'协议=> " HTTP"'为我工作。我期望EPEL repo具有logstash和elasticsearch的补充版本,但ES用于很多东西,因此没有与logstash rpms紧密耦合。
答案 2 :(得分:1)
对我来说,问题不在于elasticsearch或logstash的版本。我刚刚安装了它们,我使用的是最新版本(分别为1.5.0和1.4.2)。
运行以下内容也适合我:
logstash -e 'input { stdin { } } output { elasticsearch { protocol => "http" } }'
但我想深究为什么我无法通过其他协议连接。虽然documentation没有说明默认协议是什么,但我很确定我默认使用传输或节点作为端口9300,因为我在开始弹性搜索时得到了以下输出
[2015-04-14 22:21:56,355][INFO ][node ] [Super-Nova] version[1.5.0], pid[10796], build[5448160/2015-03-23T14:30:58Z]
[2015-04-14 22:21:56,355][INFO ][node ] [Super-Nova] initializing ...
[2015-04-14 22:21:56,358][INFO ][plugins ] [Super-Nova] loaded [], sites []
[2015-04-14 22:21:58,186][INFO ][node ] [Super-Nova] initialized
[2015-04-14 22:21:58,187][INFO ][node ] [Super-Nova] starting ...
[2015-04-14 22:21:58,257][INFO ][transport ] [Super-Nova] bound_address {inet[/127.0.0.1:9300]}, publish_address {inet[/127.0.0.1:9300]}
[2015-04-14 22:21:58,273][INFO ][discovery ] [Super-Nova] elasticsearch/KPaTxb9vRnaNXBncN5KN7g
[2015-04-14 22:22:02,053][INFO ][cluster.service ] [Super-Nova] new_master [Super-Nova][KPaTxb9vRnaNXBncN5KN7g][Azads-MBP-2][inet[/127.0.0.1:9300]], reason: zen-disco-join (elected_as_master)
[2015-04-14 22:22:02,069][INFO ][http ] [Super-Nova] bound_address {inet[/127.0.0.1:9200]}, publish_address {inet[/127.0.0.1:9200]}
[2015-04-14 22:22:02,069][INFO ][node ] [Super-Nova] started
首先,我尝试按照这些instructions打开端口9300。这并没有改变任何事情,所以很可能该端口没有被阻止。
然后我偶然发现了github issue。那里没有真正有帮助的解决方案,但我通过检查elasticsearch.yaml进行了双重检查以确保我的elasticsearch集群名称是正确的(此文件通常存储在elasticsearch安装的位置。运行“which elasticsearch”给你一个想法在哪里看)。瞧,我的弹性聚类。我的名字附加了它。删除它以使群集名称只是“elasticsearch”帮助logstash发现我的弹性搜索实例。