gpt4 book ai didi

python-3.x - Elasticsearch 嗅探失败

转载 作者:行者123 更新时间:2023-12-02 23:45:00 24 4
gpt4 key购买 nike

我正在使用 flex 搜索python客户端。当我在客户端中传递嗅探参数时,它将为后续调用返回ConnectionRefused错误。奇怪的是它从本地主机调用get all nodes,我认为这可能是问题。请让我知道我在想什么?

码:

elastic_search_client = elasticsearch.Elasticsearch(['host1:port', 'host2:port'],
sniff_on_start=True,
sniff_on_connection_fail=True,
sniffer_timeout=60)

堆栈跟踪:
  GET http://127.0.0.1:9200/ [status:N/A request:0.001s] Traceback (most recent call last):   File "/env/lib/python3.7/site-packages/urllib3/connection.py", line 160, in
_new_conn
(self._dns_host, self.port), self.timeout, **extra_kw File "/env/lib/python3.7/site-packages/urllib3/util/connection.py", line 84, in create_connection
raise err File "/env/lib/python3.7/site-packages/urllib3/util/connection.py", line 74, in create_connection
sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/env/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 229, in perform_request
method, url, body, retries=Retry(False), headers=request_headers, **kw File "/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/env/lib/python3.7/site-packages/urllib3/util/retry.py", line 379, in increment
raise six.reraise(type(error), error, _stacktrace) File "/env/lib/python3.7/site-packages/urllib3/packages/six.py", line 735, in reraise
raise value File "/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
chunked=chunked, File "/env/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw) File "/opt/python3.7/lib/python3.7/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked) File "/opt/python3.7/lib/python3.7/http/client.py", line 1298, in
_send_request
self.endheaders(body, encode_chunked=encode_chunked) File "/opt/python3.7/lib/python3.7/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked) File "/opt/python3.7/lib/python3.7/http/client.py", line 1026, in
_send_output
self.send(msg) File "/opt/python3.7/lib/python3.7/http/client.py", line 966, in send
self.connect() File "/env/lib/python3.7/site-packages/urllib3/connection.py", line 187, in connect
conn = self._new_conn() File "/env/lib/python3.7/site-packages/urllib3/connection.py", line 172, in
_new_conn
self, "Failed to establish a new connection: %s" % e urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x3e6d58342c10>: Failed to establish a new connection: [Errno 111] Connection refused

最佳答案

在elasticsearch.yml中,需要将network.host值更改为节点的ip而不是localhost的ip

关于python-3.x - Elasticsearch 嗅探失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61904758/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com