es无法访问报错:failed to authenticate user [elastic]”

报错详情

es的9200端口无法访问,查看es pod日志报错信息如下:
"message": "Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]"

file

解决

查看日志有一行输出:"stacktrace": ["org.elasticsearch.action.UnavailableShardsException: at least one primary shard for the index [.security-7] is unavailable",

证明是es的.security-7索引损坏。这个索引包括了用户登录的一些信息。

es版本是7.17.3,启用了xpack,用了keystore,所以不能直接重置密码。

参考文档:https://discuss.elastic.co/t/elk-7-8-0-two-node-cluster-at-least-one-primary-shard-for-the-index-security-7-is-unavailable/261031

创建新用户,授予管理员权限,再用这个用户删掉.security-7索引,再重启es。

elasticsearch-users useradd restore_user -p xxxxx -r superuser
curl -X DELETE "127.0.0.1:9200/.security-*" -u restore_user

file

file

删除索引后,重启es,可以正常访问。但是接入kibana时,报错再次出现。

再次进入容器创建restore_user用户,查看.security-7索引异常原因。

file

报错中显示了.security-7索引有默认的tier:data_content,es集群中没有这个角色,所以无法分配。

解决方法

新增data_content角色节点。或者手动指定.security-7索引为data_hot或者data_warm角色。

这里采用了第二种方法:

curl 127.0.0.1:9200/.security-7/_settings -X PUT -u restore_user -H 'Content-Type: application/json' -d '{"index.routing.allocation.include._tier_preference": "data_hot"}'

file

集群恢复正常。

0 0 投票数
文章评分
订阅评论
提醒
guest

0 评论
内联反馈
查看所有评论

相关文章

开始在上面输入您的搜索词,然后按回车进行搜索。按ESC取消。

返回顶部
0
希望看到您的想法,请您发表评论x