[英]Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for “localhost” port 9200) (Faraday::ConnectionFailed)
[英]Connection refused - connect(2) for “localhost” port 9200 with DigitalOcean
我使用DigitalOcean作為我的Ruby on Rails應用程序與Elasticsearch。 所以我得到了
Faraday::ConnectionFailed in PetsController#create
Connection refused - connect(2) for "localhost" port 9200
我想知道是不是因為我沒有在DigitalOcean上使用localhost。 我猜我是否必須在我的應用程序中更改它以開始收聽我用於DigitalOcean的IP地址,但我不確定應該在哪里查看。
您可以在digitalocean上查看以下內容:
sudo vi /etc/elasticsearch/elasticsearch.yml
尋找:
network.bind_host: localhost
來源: https : //www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-on-an-ubuntu-vps
還有,你確定elasticsearch正在運行嗎? 以下命令應該為您提供一個哈希結果:
curl localhost:9200
如果不是:嘗試啟動它並再試一次:
sudo service elasticsearch start
此外,您可能希望自動啟動elasticsearch,如此處所述https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-service.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.