解决ES集群启动失败 skipping cluster bootstrapping as local node does not match bootstrap requirements:[xxx]
ElasticSearch启动集群保存异常信息skipping cluster bootstrapping as local node does not match bootstrap requirements: [node-1][2022-04-17T13:20:37,643][WARN ][o.e.c.c.ClusterFormationFailureHelper] [node-2] mast
·
ElasticSearch启动集群报错
异常信息
skipping cluster bootstrapping as local node does not match bootstrap requirements: [node-1]
[2022-04-17T13:20:37,643][WARN ][o.e.c.c.ClusterFormationFailureHelper] [node-2] master not
discovered yet, this node has not previously joined a
bootstrapped (v7+) cluster, and this node must discover master-
eligible nodes [node-1] to bootstrap a cluster: have discovered
[{node-2}{MlMdU-T9QTCNu8T8_F-Abw}{Jh_hJt9FQImk3er8gNp4KQ}
{127.0.0.1}{127.0.0.1:9301}{cdfhilmrstw}]; discovery will
continue using [127.0.0.1:9300] from hosts providers and [{node-
2}{MlMdU-T9QTCNu8T8_F-Abw}{Jh_hJt9FQImk3er8gNp4KQ}{127.0.0.1}
{127.0.0.1:9301}{cdfhilmrstw}] from last-known cluster state;
node term 0, last-accepted version 0 in term 0
这个错误信息网上有很多解决方案,但都没说明一点,就是由于账号密码配置而导致的连接失败
正常根据网上资源和官方文档介绍后,我们会进行以下配置
原配置信息
我们目前集群信息是一主一从,没办法白嫖的阿里云机子才2g
只能这样子配置
集群名称:es-kkmigu
主节点:node-1
、127.0.0.1:9200\9300
从节点:node-2
、127.0.0.1:9201\9301
主节点:前面经过账号密码配置,所以下面代码会使用xpack
这个对象的配置信息
# 集群名称
cluster.name: es-kkmigu
# # # 启动地址,如果不配置,只能本地访问
network.host: 127.0.0.1
# # # 节点名称
node.name: node-1
# # # 初始化时master节点的选举列表
cluster.initial_master_nodes: node-1
# 集群节点列表
discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301"]
# #主节点
node.master: true
# # # 对外提供服务的端口
http.port: 9200
# # # 内部服务端口
transport.port: 9300
# # # 跨域支持
http.cors.enabled: true
# # # 账号密码配置
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
从节点:
# 集群名称
cluster.name: es-kkmigu
# # # 启动地址,如果不配置,只能本地访问
network.host: 127.0.0.1
# # # 节点名称
node.name: node-2
# # # 初始化时master节点的选举列表
cluster.initial_master_nodes: node-1
# 集群节点列表
discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301"]
# # # 对外提供服务的端口
http.port: 9201
# # # 内部服务端口
transport.port: 9301
# # # 跨域支持
http.cors.enabled: true
# # # 账号密码配置
#xpack.security.enabled: true
#xpack.license.self_generated.type: basic
以上配置正常来说是无任何问题的
1.4.3、解决方案
在ElasticSearch bin
目录下执行
./elasticsearch-certutil cert
这边提示文件名称和密码我直接回车执行了
Please enter the desired output file [elastic-certificates.p12]:
Enter password for elastic-certificates.p12 :
我们只需生成一份证书即可,分别拷贝到各自节点的config/certs
目录(这边我再创建一个certs
目录)下
在每个节点都添加以下配置
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12
重启各自节点
此时再去访问ElasticSearch
的Head
插件,就会有两个节点了
Ps.遇到其他问题,账号密码忘记
文档:https://www.jianshu.com/p/6c481f8e548c
curl -u kkmigu -XPUT 'http://localhost:9200/_xpack/security/user/elastic/_password?pretty' -H 'Content-Type: application/json' -d'
{
"password" : "elastic"
}
'
配置成功后,ElasticSearch
会返回一个:{}
更多推荐
已为社区贡献1条内容
所有评论(0)