簡體   English   中英

AWS elasticsearch 服務拋出 Faraday::ConnectionFailed: Failed to open TCP connection to https:80 (getaddrinfo: Name or service not known)

[英]AWS elasticsearch service throws Faraday::ConnectionFailed: Failed to open TCP connection to https:80 (getaddrinfo: Name or service not known)

我目前正在嘗試在我的 Rails v 5.1.4 應用程序中配置 AWS 的 elasticsearch 服務。 我正在使用elasticsearch-rails 6.0.0. 我目前遇到的問題是我的 elasticsearch 客戶端是如何在我的初始化程序中設置的。 我的一個限制是我不能使用faraday_middleware-aws-signers-v4 gem 來幫助我的 AWS elasticsearch 實例和我的應用程序之間的通信。 我正在嘗試僅使用aws-sdk-rails 1.0.1.來執行此操作aws-sdk-rails 1.0.1. 由於此服務器與 elasticsearch 實例位於同一安全組中,因此我假設我不需要傳入憑據。

這是我的錯誤:

Faraday::ConnectionFailed: Failed to open TCP connection to https:80 (getaddrinfo: Name or service not known)
from /usr/local/lib/ruby/2.4.0/net/http.rb:906:in `rescue in block in connect'`

這是我的initializers/elasticsearch.rb

config = {
  hosts: {host: 'https://search-epl-elasticsearch-xxxxxxxxxxxxxxxxxx.us-east-2.es.amazonaws.com', port: '80'},
  transport_options: {
    request: { timeout: 5 }
  }
}
Elasticsearch::Model.client = Elasticsearch::Client.new(config)

我意識到這是幾個月后,但似乎您正在使用 https url 配置 elasticsearch 並告訴它使用端口 80 而不是 443。試試這個:

config = {
  url: 'https://search-epl-elasticsearch-xxxxxxxxxxxxxxxxxx.us-east-2.es.amazonaws.com',
  transport_options: {
    request: { timeout: 5 }
  }
}
Elasticsearch::Model.client = Elasticsearch::Client.new(config)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM