我们在配置ElasticSearch服务的时候,有时候需要设置账户密码权限,有可能会出现类似“Cluster state has not been recovered yet, cannot write to the [null] index”的错误信息,如下图所示:
出现该错误的主要原因是没有设置ElasticSearch的主节点配置,我们只需要在elasticsearch.yml配置文件中设置单节点或者集群节点的主节点名称即可,如下所示:
#主节点名称,如果不设置,在启用账户密码的时候可能会报“Cluster state has not been recovered yet, cannot write to the [null] index”之类的错误
cluster.initial_master_nodes: ["node-1"]
在设置了该配置之后再去设置账户密码,即可设置成功,如下图所示: