最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Python中solr出错:SolrClient.exceptions.ConnectionError NewConnectionError Failed to establish a new connection Errno 61 Connection refused

Python crifan 4852浏览 0评论

折腾:

【已解决】合并基于搜索的兜底对话到产品Demo中

期间,运行别人的基于搜索的对话,其中内部用到solr,此处运行出错:

<code>Traceback (most recent call last):
  File "/Users/crifan/.virtualenvs/xxx-gXiJ4vtz/lib/python3.6/site-packages/SolrClient/transport/transportbase.py", line 39, in inner
    return function(self, host, **kwargs)
  File "/Users/crifan/.virtualenvs/xx-gXiJ4vtz/lib/python3.6/site-packages/SolrClient/transport/transportbase.py", line 57, in send_request
    res_dict, c_inf = self._send(host, **kwargs)
  File "/Users/crifan/.virtualenvs/xx-gXiJ4vtz/lib/python3.6/site-packages/SolrClient/transport/transportrequests.py", line 61, in _send
    raise ConnectionError('N/A', str(e), e)
SolrClient.exceptions.ConnectionError: ('N/A', "HTTPConnectionPool(host='localhost', port=8983): Max retries exceeded with url: /solr/qa/select?q=question_str%3A%22sing+a+song%22&amp;fq=%2A%3A%2A+AND+scene%3Aqa&amp;rows=1&amp;fl=question%2Canswer%2Cid&amp;wt=json&amp;indent=false (Caused by NewConnectionError('&lt;urllib3.connection.HTTPConnection object at 0x13d2eb9e8&gt;: Failed to establish a new connection: [Errno 61] Connection refused',))", ConnectionError(MaxRetryError("HTTPConnectionPool(host='localhost', port=8983): Max retries exceeded with url: /solr/qa/select?q=question_str%3A%22sing+a+song%22&amp;fq=%2A%3A%2A+AND+scene%3Aqa&amp;rows=1&amp;fl=question%2Canswer%2Cid&amp;wt=json&amp;indent=false (Caused by NewConnectionError('&lt;urllib3.connection.HTTPConnection object at 0x13d2eb9e8&gt;: Failed to establish a new connection: [Errno 61] Connection refused',))",),))
</code>

看起来是没有运行对应的服务。

SolrClient.exceptions.ConnectionError NewConnectionError Failed to establish a new connection Errno 61 Connection refused

Connection refused after large number of queries · Issue #16 · stanfordnlp/stanza

HTTPConnectionPool for python · Issue #12 · facebookresearch/visdom

Failed to establish a new connection: [Errno 61] Connection refused · Issue #98 · chrismattmann/tika-python

ConnectionError · Issue #598 · elastic/elasticsearch-py

python solr SolrClient.exceptions.ConnectionError

Solr + Python — A Tutorial – DEV Community 👩‍💻👨‍💻

avremel/Solr-Python-Tutorial: Code samples for https://dev.to/avremel/solr–pythona-tutorial-3cni

python – Indexing documents with SolrClient – Stack Overflow

django-haystack/pysolr: Pysolr — the official source.

“solr = pysolr.Solr(‘http://localhost:8983/solr/’, timeout=10, auth=<type of authentication>)”

此处Pipfile中安装的是:

solrclient = “*”

所以去搜:

python solrclient

SolrClient · PyPI

moonlitesolutions/SolrClient: SolrClient is a simple python library for Solr; built in python3 with support for latest features of Solr.

“solr = SolrClient(‘http://localhost:8983/solr’)”

都还是没有介绍,如何运行solr的服务

SolrClient 0.2.0 — SolrClient 0.2.0 documentation

SolPython – Solr Wiki

2.1.7.1.7. solrclient.SOLRValuesResponseIterator — DataONE Client Library for Python 1.0.0 documentation

Solr + Python — A Tutorial – Avremel Kaminetzky – Medium

感觉问题转换为:

【已解决】Mac中安装Solr的server并启动Solr服务

所以此处时Mac本地虽然安装了Solr的server并运行server了。

但是由于此处代码中内部调用的solr的服务器端需要额外配置,而最终代码运行的在线的环境已经正常运行了此solr的服务了。

本地Mac中,暂时没必要一定要去运行起来此solr去调试,所以可以暂时忽略此问题。

如果之后Mac本地一定要继续调试次solr,到时候再说。

不过发现为了后续完整的合并兜底对话,此处还是要彻底解决此问题才行。

后来解决了此问题:

【记录】Mac本地Solr中新建qa的collection再运行脚本导入数据

转载请注明:在路上 » 【已解决】Python中solr出错:SolrClient.exceptions.ConnectionError NewConnectionError Failed to establish a new connection Errno 61 Connection refused

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.169 seconds, using 22.14MB memory