Elasticsearch 中误操作删除了所有用户解决办法

如果在 Elasticsearch 中误操作删除了所有用户,可以通过以下步骤重新创建用户和密码:

  1. 在配置文件中开启 x-pack 验证,修改config(一般是在/usr/share/elasticsearch)目录下面的elasticsearch.yml文件,添加以下内容并重启:

    复制代码
    xpack.security.enabled: true
    xpack.license.self_generated.type: basic
    xpack.security.transport.ssl.enabled: true
  2. 执行设置用户名和密码的命令,需要为4个用户分别设置密码,包括elastickibanalogstash_systembeats_system

    复制代码
    bin/elasticsearch-setup-passwords interactive
    initiating the setup of passwords for reserved users elastic,kibana,logstash_system,beats_system.
    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):
    Passwords do not match. Try again.
    Enter password for (elastic):
    Reenter password for (elastic):
    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):
    Changed password for user (kibana)
    Changed password for user (logstash_system)
    Changed password for user (beats_system)
    Changed password for user (elastic)
  3. 后续需要修改密码,命令如下:

    复制代码
    curl -H "Content-Type:application/json" -XPOST -u elastic 'http://127.0.0.1:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'

备注:请谨慎删除security索引,这个是系统用户密码保存的索引。

相关推荐
FPGA小迷弟3 小时前
ChatGPT回答用AI怎么怎么赚钱
大数据·人工智能
AllData公司负责人4 小时前
实时开发平台(Streampark)--Flink SQL功能演示
大数据·前端·架构·flink·开源
小坏讲微服务6 小时前
MaxWell中基本使用原理 完整使用 (第一章)
大数据·数据库·hadoop·sqoop·1024程序员节·maxwell
2301_797604247 小时前
d47:Elasticsearch入门
elasticsearch
勇往直前plus8 小时前
ElasticSearch详解(篇一)
大数据·elasticsearch·jenkins
大哥,带带弟弟8 小时前
ES错误记录
elasticsearch·kubernetes
一只小青团10 小时前
Hadoop之HDFS
大数据·hadoop·分布式
ITVV10 小时前
hadoop-3.4.1 单机伪部署
大数据·linux·hadoop
小杜谈数11 小时前
企业BI建议--数据治理平台
大数据
谅望者11 小时前
数据分析笔记07:Python编程语言介绍
大数据·数据库·笔记·python·数据挖掘·数据分析