Herman Schaaf
Herman Schaaf

Reputation: 48485

Django Haystack reporting `Errno 111: Connection Refused` connecting to Solr

For one or another reason, recently my Django Haystack Solr application stopped working. I'm using Haystack 1.2.7, and this is the error when trying to make a Solr query:

Failed to query Solr using '(name_auto:test) AND (django_ct:cities.city)': [Errno 111] Connection refused

The obvious answer would be that my HAYSTACK_SOLR_URL is wrong, or that Solr is not running. I checked both these possibilities, and Solr is running, as it always has been, on the same address as the one specified in HAYSTACK_SOLR_URL. I can open it in a web browser, and even make queries on the web interface.

HAYSTACK_SITECONF = 'project.search_sites'
HAYSTACK_SEARCH_ENGINE = 'solr'
HAYSTACK_SOLR_URL = 'http://localhost:8080/solr'

So could there be another reason that Solr is refusing connections? How can I check? How do I fix it?

Upvotes: 1

Views: 1303

Answers (1)

Herman Schaaf
Herman Schaaf

Reputation: 48485

The problem seems to have been caused by a recent system update that updated Jetty, the HTTP server I'm using to run Solr. It was refusing connections, because its settings file only allowed certain users. So I edited /etc/default/jetty to contain this line:

JETTY_HOST=0.0.0.0

So it now accepts all incoming connections, solving the problem. You can also specify the specific connection that Django will be using, to limit the possibility of abuse.

Upvotes: 2

Related Questions