折腾:
期间,运行别人的基于搜索的对话,其中内部用到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&fq=%2A%3A%2A+AND+scene%3Aqa&rows=1&fl=question%2Canswer%2Cid&wt=json&indent=false (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x13d2eb9e8>: 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&fq=%2A%3A%2A+AND+scene%3Aqa&rows=1&fl=question%2Canswer%2Cid&wt=json&indent=false (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x13d2eb9e8>: 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
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
“solr = SolrClient(‘http://localhost:8983/solr’)”
都还是没有介绍,如何运行solr的服务
SolrClient 0.2.0 — SolrClient 0.2.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