我想将 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}
可能是什么问题呢?
最佳答案
连接被拒绝表示 Logstash 无法连接到 Elasticsearch。
可能的原因有以下三种:
network.host=0.0.0.0
绑定(bind)到所有地址)基本诊断应该告诉你是怎么回事。
netstat -an | grep 9200
查看 Elasticsearch 是否正在运行并绑定(bind)到特定地址。 getenforce
查看是否启用了 SELinux。
关于elasticsearch - 连接被拒绝 { :class= >"Manticore::SocketException", :level=>:error},我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49488631/