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

相关推荐
汇智信科18 小时前
智慧矿山和工业大数据解决方案“智能设备管理系统”
大数据·人工智能·工业大数据·智能矿山·汇智信科·智能设备管理系统
阿里云大数据AI技术18 小时前
Hologres Dynamic Table 在淘天价格力的业务实践
大数据·人工智能·阿里云·hologres·增量刷新
OpenCSG21 小时前
新能源汽车行业经典案例 — 某新能源汽车 × OpenCSG
大数据·人工智能·汽车·客户案例·opencsg
外参财观1 天前
流量变现的边界:携程金融按下暂停键后的冷思考
大数据·人工智能·金融
CCPC不拿奖不改名1 天前
两种完整的 Git 分支协作流程
大数据·人工智能·git·python·elasticsearch·搜索引擎·自然语言处理
a努力。1 天前
字节Java面试被问:TCP的BBR拥塞控制算法原理
java·开发语言·python·tcp/ip·elasticsearch·面试·职场和发展
智在碧得1 天前
碧服打造DataOps全链路闭环,定义大数据工程化发布新标杆
大数据·网络·数据库
亿信华辰软件1 天前
构建智慧数据中台,赋能饮料集团全链路数字化转型新引擎
大数据·人工智能·云计算
Elastic 中国社区官方博客1 天前
使用瑞士风格哈希表实现更快的 ES|QL 统计
大数据·数据结构·sql·elasticsearch·搜索引擎·全文检索·散列表
isNotNullX1 天前
什么是数字脱敏?一文讲透数字脱敏概念
大数据·数据安全·数据可视化·数字脱敏