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=*********

相关推荐
半夏知半秋17 小时前
Elasticsearch Query DSL 指令整理
大数据·数据库·笔记·学习·elasticsearch·搜索引擎·全文检索
半夏知半秋17 小时前
Elasticsearch专用的ES|QL语法指令整理
大数据·数据库·elasticsearch·搜索引擎·全文检索
Elasticsearch18 小时前
从数据到部署:推进美国州政府中 AI agent 的负责任使用
elasticsearch
Elasticsearch21 小时前
Streams 处理:告别 Grok 的困扰 - 在 Streams 中解析你的日志
elasticsearch
Elasticsearch21 小时前
Elasticsearch:使用判断列表评估搜索查询相关性
elasticsearch
武子康1 天前
大数据-181 Elasticsearch 段合并与磁盘目录拆解:Merge Policy、Force Merge、Shard 文件结构一文搞清
大数据·后端·elasticsearch
Elastic 中国社区官方博客1 天前
如何通过个性化、分群感知排序来提升电商搜索相关性
大数据·数据库·elasticsearch·搜索引擎·全文检索
Lisonseekpan1 天前
Elasticsearch 入门指南
大数据·分布式·后端·elasticsearch·搜索引擎
车斗1 天前
windows10 上安装 elasticsearch
开发语言·elasticsearch·全文检索
Lisonseekpan1 天前
技术选型分析:MySQL、Redis、MongoDB、ElasticSearch与大数据怎么选?
大数据·redis·后端·mysql·mongodb·elasticsearch