1

我正在尝试使用 ./manage.py rebuild_index 第一次在 ubuntu 上为 Django 构建我的 solr 索引,但出现以下错误:

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)

我可以通过我的网络浏览器访问 localhost:8983/solr/ 和 localhost:8983/solr/admin

4

2 回答 2

4

你可以顶一下TIMEOUTsettings.py

例如

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
        'URL': 'http://127.0.0.1:8080/solr/default',
        'INCLUDE_SPELLING': True,
        'TIMEOUT': 60 * 5,
    },
}
于 2013-11-06T04:13:13.583 回答
0

这里重要的是你不应该增加默认超时,因为它可能会阻塞你所有的工作人员,因为 haystack 同步工作。避免这种情况的最好方法是为具有不同超时的读取和写入定义多个连接并定义。

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

并使用路由器进行读写分离http://django-haystack.readthedocs.org/en/v2.4.0/multiple_index.html#automatic-routing

于 2015-12-01T12:31:59.803 回答