使用eland连接Elasticsearch时连接超时

1mrurvl1  于 2023-06-29  发布在  ElasticSearch
关注(0)|答案(1)|浏览(146)

我正在尝试使用eland库远程连接到我的3节点Elasticsearch(版本8.3.3)集群。我先试一个节点。此节点在elasticsearch.yml中具有以下配置。

network.host: 1.2.3.4

xpack.security.enabled: true

xpack.security.http.ssl:
  enabled: false

xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: xxx
  truststore.path: xxx

http.hosttransport.host都在配置文件中注解掉了。
我在Jupyter Notebook的另一个服务器上有以下代码。

from elasticsearch import Elasticsearch
import eland as ed

es = Elasticsearch([{'host': "1.2.3.4", 'port': 9200, 'scheme': 'http'}], basic_auth=("xxx","yyy"), request_timeout=120)

index="abc"
fields=["@timestamp", "fieldA", "fieldB"]

df = ed.DataFrame(es, index, columns=fields)

我一直得到Connection timed out。仅运行es.info()也会得到Connection timed out错误。
我该怎么办?

jtw3ybtb

jtw3ybtb1#

Tldr

我相信这可能是因为你正在使用的计划。
你不应该使用https吗?

解决方案

from elasticsearch import Elasticsearch
import eland as ed

es = Elasticsearch([{'host': "1.2.3.4", 'port': 9200, 'scheme': 'https'}], basic_auth=("xxx","yyy"), request_timeout=120)
                                                                 ^^^^^ here
index="abc"
fields=["@timestamp", "fieldA", "fieldB"]

df = ed.DataFrame(es, index, columns=fields)

相关问题