无法与 elasticsearch 建立连接错误

赛拉加瓦

我一直在学习有关开发个性化语音助手的简单教程。为此,我正在使用 Elasticsearch。当我尝试运行代码时,我收到了来自 elasticsearch 的错误提示Failed to establish new connection我不确定是什么导致了这个错误,因为我已经安装了 elasticsearch 和它的 python 客户端。

我已经检查过我是否已经安装了弹性搜索和它的 python 客户端,我已经完成了。我已经通过pip3安装安装了python客户端。我还检查了连接 U​​RL 是否正确,我相信它是正确的,即https://localhost:9200/.

我正在使用 macOS。

s = Elasticsearch(['https://localhost:9200/'])
bulk(es, records, index='voice_assistant', doc_type='text', raise_on_error=True)
def search_es(query):
    res = es.search(index="voice_assistant", doc_type="text", body={                     
    "query" :{
        "match": {
            "voice_command": {
                "query": query,
                "fuzziness": 2
            }
            }
        },
    })
    return res['hits']['hits'][0]['_source']['sys_command'

实际的错误信息是

File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 105, in perform_request
    raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.VerifiedHTTPSConnection object at 0x1266dce10>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.VerifiedHTTPSConnection object at 0x1266dce10>: Failed to establish a new connection: [Errno 61] Connection refused)

任何人都可以帮我解决这个错误。我第一次使用elasticsearch。

编辑:我尝试在终端中运行 elasticsearch 并且收到以下警告,

OpenJDK 64-Bit Server VM warning: Cannot open file logs/gc.log due to No such file or directory

我在谷歌上进一步搜索了这个警告,并找到了一个答案,提到它可能在弹性搜索中可能是错误的,我不确定,因为我使用的是最新版本。我提到的答案是

https://stackoverflow.com/questions/48696080/java-hotspottm-64-bit-server-vm-warning-cannot-open-file-logs-gc-log-due-to-no

Edit2:现在当我尝试在 erminal 中启动 elasticsearch 时,我收到以下错误

StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/local/var/lib/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.4.0.jar:7.4.0]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.4.0.jar:7.4.0]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.4.0.jar:7.4.0]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.4.0.jar:7.4.0]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.4.0.jar:7.4.0]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.4.0.jar:7.4.0]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.4.0.jar:7.4.0]

我昨天也遇到了同样的错误,但是当我重新启动系统时,一切正常,是不是因为某种操作正在运行,并且它是否有任何特定killall命令在启动之前终止所有操作?

亚什·坦顿

通过使用最新版本的 python-es 模块,问题得到了解决,因此最好升级模块。在上述情况下,以前使用的版本是 2.4.0v,现在使用的最新版本是 6.0.0v,因此问题得到解决。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法捕获 ElasticSearch 连接错误

无法建立新的连接错误

无法建立新的连接:[Errno 111]连接被拒绝(elasticsearch)

在Docker内部使用elasticsearch:无法建立新连接

Wget返回错误:“无法建立SSL连接。”

错误:无法与R会话建立连接

Docker-Elasticsearch-无法建立新连接:[Errno 111]连接被拒绝',))

Elasticsearch问题:无法连接AWS Elasticsearch服务

Kibana 无法连接 ElasticSearch (Azure)

filebeat 无法连接到elasticsearch

无法建立新连接,Docker-Compose Django + Haystack + Mysql + ElasticSearch

Blazor 错误:无法建立 SSL 连接,请参阅内部异常

Python 请求失败,无法建立新的连接错误 10061

如果无法建立连接,则防止出现错误警告

“ 500错误:无法建立背面连接”-Bluemix Selenium Tests

无法建立安全连接

连接到ProFTPD时出现FileZilla错误:“无法建立数据连接:ETIMEDOUT-连接尝试超时”

ElasticSearch安装错误-curl:(7)无法连接到localhost:9200; 拒绝连接

Kibana将无法连接到Amazon Elasticsearch Service上的Elasticsearch

Kibana无法在Docker上连接到Elasticsearch

Packetbeat 无法连接到 elasticsearch docker

Docker上的Kibana无法连接到Elasticsearch

Elasticsearch无法访问:连接被拒绝

无法在Ubuntu上的9200中连接Elasticsearch

无法将Kibana连接到Elasticsearch

无法从Spark连接到AWS Elasticsearch

无法在 Docker 中连接到 Elasticsearch

无法连接到 GetCandy 内的 ElasticSearch

无法连接到wss://(连接建立错误:net :: ERR_CONNECTION_CLOSED)