连接被拒绝{:class =>“Manticore :: SocketException”,:level =>:error}

问题描述 投票:2回答:1

我想将ELK堆栈用于rails上的应用程序。 Logstash标准配置:

input { stdin { } }

filter {
  grok {
    match => { "message" => "%{COMBINEDAPACHELOG}" }
  }
  date {
    match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
  }
}

output {
  elasticsearch { hosts => ["localhost:9200"] }
  stdout { codec => rubydebug }
}

当我在终端(cat development.log | nice bin/logstash -f logstash.conf)中执行命令时,会发生以下错误:

 Connection refused {:class=>"Manticore::SocketException", :level=>:error}
 Connection refused {:class=>"Manticore::SocketException", :level=>:error}
 Settings: Default pipeline workers: 2
 Connection refused {:class=>"Manticore::SocketException", :level=>:error}
 Connection refused {:class=>"Manticore::SocketException", :level=>:error}
 Logstash startup completed
 Attempted to send a bulk request to Elasticsearch configured at '["http://localhost:9200/"]', but Elasticsearch appears to be unreachable or down! {:client_config=>{:hosts=>["http://localhost:9200/"], :ssl=>nil, :transport_options=>{:socket_timeout=>0, :request_timeout=>0, :proxy=>nil, :ssl=>{}}, :transport_class=>Elasticsearch::Transport::Transport::HTTP::Manticore, :logger=>nil, :tracer=>nil, :reload_connections=>false, :retry_on_failure=>false, :reload_on_failure=>false, :randomize_hosts=>false}, :error_message=>"В соединении отказано (Connection refused)", :class=>"Manticore::SocketException", :level=>:error}

可能是什么问题呢?

elasticsearch logstash elastic-stack
1个回答
1
投票

拒绝连接表示Logstash无法连接到Elasticsearch。

有三个可能的原因:

  1. 您没有在与logstash相同的主机上运行Elasticsearch(您已将其配置为localhost:9200,这意味着您希望它在同一台计算机上运行)。
  2. 您已将Elasticsearch配置为绑定到本地计算机上的特定IP地址而不是所有地址(更改elasticsearch.yml以使network.host=0.0.0.0绑定到所有地址)
  3. 您正在使用SELinux处于强制模式的服务器上运行,但它未配置为允许logstash和elasticsearch之间的连接。

基本诊断应该告诉你是什么情况。 netstat -an | grep 9200查看Elasticsearch是否正在运行并绑定到特定地址。 getenforce看看是否启用了SELinux。

© www.soinside.com 2019 - 2024. All rights reserved.