Errno::ECONNREFUSED in – Ruby on Rails

First problem of the morning – Errno::ECONNREFUSED in ProductsController#create. This one was actually a little bit tricky – for me anyway. The error seemed to imply a database issue, so I started by checking all the common problems there however no luck unfortunately.

After a bit of a Google I came across a post mentioning that a few people had encountered this after installing Solr. I had previously setup Sunspot, which just so happens to sit on top of Solr.

Manually starting solr fixed the problem – just using the code below:

chris@chris-VirtualBox:~/site$ rake sunspot:solr:start


I’m not really sure what triggered the error as I’d been using the exact same functionality all morning without any changes or issues. Thankfully it’s a quick fix. If anyone has anymore info on the problem please let me know.

Anyway, that’s all I’ve got for you for now, Good Luck!

UPDATE: I had this problem again this morning and realised that it was the models with search fields still defined that were triggering the error. Removing this code seems to have completely resolved the issue.

1 thought on “Errno::ECONNREFUSED in – Ruby on Rails

  1. James

    This is also very true for all search services that you use.

    In my case I have Tire which is a rails library for ElasticSearch. Because ElasticSearch wasn’t running I was getting Errno::ECONNREFUSED as well.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s