windows中elasticsearch7中添加用户名密码验证

1.找到elsatic的bin目录输入cmd

2.生成ca证书

输入

elasticsearch-certutil ca

在es7根目录生成ca证书,输入密码时直接回车即可,否则后面会报错

Please enter the desired output file elastic-stack-ca.p12: #这里直接回车即可

Enter password for elastic-stack-ca.p12 : #这里直接回车即可,不要设置密码

完成后可看到es根目录生成ca证书

3.生成p12秘钥

使用第一步生成的证书,生成p12秘钥

elasticsearch-certutil cert --ca elastic-stack-ca.p12

Enter password for CA (elastic-stack-ca.p12) : 直接回车

Please enter the desired output file elastic-certificates.p12:直接回车

Enter password for elastic-certificates.p12 : #这里直接回车即可,不要设置密码,否则后面ES无法启动

完成后即可在根目录看到p12密钥

附录

若此处报jdk错误,即可改成es7自带的jdk即可

打开elasticsearch-env.bat

增加使用es里自带的jdk11

4.修改elasticsearch.yml配置文件

第一步:在config目录下创建certs目录

第二步:拷贝两个p12文件至certs目录

第三步:添加elasticsearch.yml配置如下

java 复制代码
xpack.security.enabled: true
 
xpack.security.transport.ssl.enabled: true
 
xpack.security.transport.ssl.verification_mode: certificate
 
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
 
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12

5.重启es

点击bin/elasticsearch.bat即可启动es

6.设置密码

elasticsearch-setup-passwords interactive

输入确认后,设置密码即可

7.根据自己的需要和系统导入的依赖在系统中配置

spring.elasticsearch.bboss.default.elasticUser=elastic

spring.elasticsearch.bboss.default.elasticPassword=*********

相关推荐
Elastic 中国社区官方博客4 小时前
将你自己的密钥用于现有 Elastic Cloud 部署
大数据·数据库·elasticsearch·全文检索
Elasticsearch5 小时前
使用 Lucene 搜索你的 Bean — 搜索
elasticsearch
专业程序开发源12 小时前
SSM校园拍摄交流服务平台36936-计算机课程设计、毕业设计
java·spring boot·后端·python·elasticsearch·php·课程设计
vx_Biye_Design15 小时前
springboot宠物寄养服务预约与监管系统82684-计算机课程设计、毕业设计
java·vue.js·spring boot·elasticsearch·课程设计·express·宠物
Elastic 中国社区官方博客16 小时前
错误最多的服务运行正常:使用 ES|QL 从日志进行根因分析
大数据·运维·数据库·sql·elasticsearch·搜索引擎·全文检索
yukai080081 天前
【203篇系列】056 我的Agent系统
大数据·elasticsearch·搜索引擎
IT大白鼠1 天前
搜索系列 · 第 08 篇——面试收官:高频题与全景总结
elasticsearch·面试·nosql
光影少年2 天前
langchain与langgraph区别以及学习路线
elasticsearch·langchain·llm
Elasticsearch2 天前
错误最多的服务运行正常:使用 ES|QL 从日志进行根因分析
elasticsearch
Elasticsearch2 天前
将你自己的密钥用于现有 Elastic Cloud 部署
elasticsearch