解决es集群启动完成后报master_not_discovered_exception(hostname有错误)
环境:elasticsearch9
问题:
es集群启动后,在浏览器输入:http://es ip地址:端口/_cat/nodes?pretty,会提示如下错误:
{ "error" : { "root_cause" : [ { "type" : "master_not_discovered_exception", "reason" : null } ], "type" : "master_not_discovered_exception", "reason" : null }, "status" : 503 }
原因:查看日志 more /var/log/elasticsearch/my-application.log
failed to resolve host [elk-host1]
java.net.unknownHostException: elk-host1
配置文件中host主机名称错误
处理修改配置文件中的主机名称:
vi /etc/elasticsearch/elasticsearch.yml 修改对应host主机名称(注意修改所有的)
cluster.initial_master_nodes: ["node-1","node-2"]
重启服务 systemctl restart elasticsearch
做一个决定,并不难,难的是付诸行动,并且坚持到底。