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索引,这个是系统用户密码保存的索引。

相关推荐
xiaoduo AI5 分钟前
客服机器人可按紧急程度排序会话?Agent 开放平台通过关键词设置优先级实现急救咨询优先处理?
大数据·机器人
hughnz1 小时前
钻井RTOC的能力以及趋势
大数据·人工智能
workflower1 小时前
机器人应用-楼宇室内巡逻
大数据·人工智能·算法·microsoft·机器人·动态规划·享元模式
电子科技圈1 小时前
从进迭时空K3看RISC-V CPU与Imagination GPU协同:如何构建高性能SoC能力
大数据·图像处理·人工智能·嵌入式硬件·边缘计算·智能硬件·risc-v
阿里云大数据AI技术1 小时前
EMR Serverless Spark 推出 Spark 4.0,加速湖仓架构下的数据处理升级
大数据·人工智能·spark
2601_949194262 小时前
springboot之集成Elasticsearch
spring boot·后端·elasticsearch
永霖光电_UVLED3 小时前
1.6T 光模块的能效革命
大数据·人工智能·汽车·娱乐
talen_hx2963 小时前
《零基础入门Spark》学习笔记 Day 17
大数据·笔记·学习·spark
Caspian Wren3 小时前
通过Logstash将MySQL数据同步到ES
数据库·mysql·elasticsearch·logstash
hf2000123 小时前
深入分析:Iceberg v3「删除向量(Deletion Vectors, DV)」如何缓解 CDC 场景写放大
大数据·spark·数据湖·湖仓一体·lakehouse