I am using DigitalOcean for my Ruby on Rails app with Elasticsearch. So I am getting
Faraday::ConnectionFailed in PetsController#create
Connection refused - connect(2) for "localhost" port 9200
I am wondering if it is because I am not using localhost on DigitalOcean. I am guessing if I have to change it in my app to start listening to the ip address I am using for DigitalOcean, but am not sure where I should look at.
Can you check the following on digitalocean:
sudo vi /etc/elasticsearch/elasticsearch.yml
Look for:
network.bind_host: localhost
source: https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-on-an-ubuntu-vps
also, are you sure elasticsearch is running? The following command should give you a hash as result:
curl localhost:9200
If not: try to start it and try again:
sudo service elasticsearch start
Also, you'll probably want to boot elasticsearch automatically like described here https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-service.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With