部署调试环境问题汇总
date
Jul 24, 2021
slug
elasticsearch-guide-debug-env-qa
status
Published
tags
Elasticsearch
读书
summary
type
Page
1. 解决 Elasticsearch 报 "None of the configured nodes are available" 错误问题
环境
在 Mac 上通过 Docker 启动 Elasticsearch,之后在 Mac 上启动 SpringBoot 应用,通过 spring-data-elasticsearch 连接 Elasticsearch。
报错
None of the configured nodes are available
解决
由于 spring-data-elasticsearch 用的是 TransportClient 连接 Elasticsearch 的,而 Elasticsearch 运行在 container 中,需要暴露出 transport 地址,使得允许通过 transport 连接。
所以需要修改 Elasticsearch container 中的
config/elasticsearch.yml
配置,增加 transport.host: 0.0.0.0
配置项,之后重启 container 即可。参考:
2. 使用 homebrew 在 Mac 上安装的 Elasticsearch 启动多个节点时,报 ”failed to obtain node locks ... maybe these locations are not writable or multiple nodes were started without increasing...“
环境:
在 Mac 中 通过 brew 安装的 Elasticsearch,之后启动一个节点,然后使用相同命令再启动另一个节点
报错:
failed to obtain node locks ... maybe these locations are not writable or multiple nodes were started without increasing...

解决:
原因是因为第二个节点的配置用了跟第一个节点一样,都是默认配置,导致数据目录,日志目录等被第一个节点加了锁。修改下配置文件中 data 和 log 所在目录,或者使用独立的配置文件。