解决 Elasticsearch 修改密码报错 master_not_discovered_exception
约 138 个字 42 行代码 预计阅读时间 1 分钟
情形
| [root@bec9c25743ab bin]# elasticsearch-setup-passwords interactive
Failed to determine the health of the cluster running at http://172.18.0.4:9200
Unexpected response code [503] from calling GET http://172.18.0.4:9200/_cluster/health?pretty
Cause: master_not_discovered_exception
It is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords.
It is very likely that the password changes will fail when run against an unhealthy cluster.
Do you want to continue with the password setup process [y/N]y
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana]:
Reenter password for [kibana]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Unexpected response code [503] from calling PUT http://172.18.0.4:9200/_security/user/apm_system/_password?pretty
Cause: Cluster state has not been recovered yet, cannot write to the [null] index
Possible next steps:
* Try running this tool again.
* Try running with the --verbose parameter for additional messages.
* Check the elasticsearch logs for additional error details.
* Use the change password API manually.
ERROR: Failed to set password for user [apm_system].
|
原因
没有设置 ElasticSearch 的主节点配置。
解决方法
在 elasticsearch.yml
配置文件中设置单节点或者集群节点的主节点名称即可。如:
| cluster.initial_master_nodes: ["node-1"]
|
如果为单节点,注意是否配置 node.name
,二者要保持一致:
| node.name: node-1
cluster.initial_master_nodes: ["node-1"]
|
来源