Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elasticsearch SocketError (getaddrinfo: Name or service not known)

I'm using the Tire gem in Ruby on Rails to use Elasticsearch for searching. On my local machine it works great.

On my staging server I (randomly?) get this error: SocketError (getaddrinfo: Name or service not known)

Sometimes it works great and is very fast, and sometimes it just throws that error.

Elasticsearch is running on the same server and the url it uses is: http://localhost:9200

I have this in my hosts file:

127.0.0.1   staging-server.mydomain.com staging-server

Where subdomain and domain are set correctly.

What could be the cause of the errors and why does it only happen sometimes?

like image 449
Linus Avatar asked Nov 11 '22 12:11

Linus


1 Answers

I had to add

127.0.0.1       localhost

to my hosts file...

like image 165
Linus Avatar answered Nov 14 '22 21:11

Linus