簡體   English   中英

彈性搜索嗅探失敗

[英]Elastic search sniffing failures

我正在使用彈性搜索 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

network.host 值需要更改為節點的 ip 而不是 elasticsearch.yml 中的 localhost

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM