重建Django Haystack索引时无法连接到Solr服务器

1 投票
1 回答
1955 浏览
提问于 2025-04-19 03:10

我遇到了以下错误:

无法将文档添加到Solr:无法连接到服务器,地址是 'http://example.com/:8983/solr/update/?commit=true',你确定这个网址是正确的吗?在浏览器中检查一下可能会有帮助: HTTP连接池(host='example.com', port=80):超过最大重试次数 访问网址:/:8983/solr/update/?commit=true(原因是:[Errno 111] 连接被拒绝)

我可以访问commit=true这个地址,它返回了这个xml: enter image description here

我可以顺利访问Solr的管理界面: enter image description here

我已经在我的安全组中打开了所有端口,特别是8983和80。

这是我的设置内容:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
        'URL': 'http://example.com/:8983/solr',
        'TIMEOUT': 60 * 5,
    },
}

为什么我无法连接来重建索引呢?

1 个回答

0

问题出在这里:

'URL': 'http://example.com/:8983/solr',

应该是这个:

'URL': 'http://example.com:8983/solr',

撰写回答