设置es用户密码时报如下错误
Unexpected response code [503] from calling PUT http://39.104.166.15:9201/_security/user/apm_system/_password?pretty
Cause: Cluster state has not been recovered yet, cannot write to the [null] index
查看日志发现master not discovered yet 尚未发现主节点
直接设置主节点即可
出现该错误的主要原因是没有设置ElasticSearch的主节点配置,我们只需要在elasticsearch.yml配置文件中设置单节点或者集群节点的主节点名称即可
在配置文件 elasticsearch.yml
中 设置主节点,切换 es 启动用户并重启
node.name: node-1
# 集群列表
discovery.seed_hosts: ["192.168.51.4","192.168.51.5","192.168.51.6"]
# node.name 值是啥设置为啥
# 启动的时候使用一个master节点
cluster.initial_master_nodes: ["node-1"]
参考: ES elasticsearch集群配置https://www.jianshu.com/p/73123a089f6bhttps://www.jianshu.com/p/73123a089f6b