Tikue Anazodo
Tikue Anazodo

Reputation: 329

Solr times out when I try to rebuild index for django

I am trying to build my solr index for Django on ubuntu for the first time with ./manage.py rebuild_index and I get the following error:

Removing all documents from your index because you said so.
Failed to clear Solr index: Connection to server 'http://localhost:8983/solr/update/?commit=true'                timed out: HTTPConnectionPool(host='localhost', port=8983): Request timed out. (timeout=10)
All documents removed.
Indexing 4 dishess
Failed to add documents to Solr: Connection to server 'http://localhost:8983/solr/update/?commit=true' timed out: HTTPConnectionPool(host='localhost', port=8983): Request timed out. (timeout=10)

I have access to localhost:8983/solr/ and localhost:8983/solr/admin via my web browser

Upvotes: 1

Views: 1332

Answers (2)

Important thing here is that you shoudn't increase default timeout, because it could possibly block all your workers as haystack works synchronously. The best way to avoid this is to define multiple connections for reads and writes with different timeouts and define.

http://django-haystack.readthedocs.org/en/latest/settings.html#haystack-connections

And use routers for read and write separation http://django-haystack.readthedocs.org/en/v2.4.0/multiple_index.html#automatic-routing

Upvotes: 0

Jess
Jess

Reputation: 429

You can bump up the TIMEOUT in settings.py.

For example

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
        'URL': 'http://127.0.0.1:8080/solr/default',
        'INCLUDE_SPELLING': True,
        'TIMEOUT': 60 * 5,
    },
}

Upvotes: 5

Related Questions