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

相关推荐
闲人编程11 小时前
Elasticsearch搜索引擎集成指南
python·elasticsearch·搜索引擎·jenkins·索引·副本·分片
先跑起来再说11 小时前
Git 入门到实战:一篇搞懂安装、命令、远程仓库与 IDEA 集成
ide·git·后端·elasticsearch·golang·intellij-idea
Dxy123931021612 小时前
深度解析 Elasticsearch:从倒排索引到 DSL 查询的实战突围
大数据·elasticsearch·搜索引擎
Dxy123931021615 小时前
别再让 ES 把你拖垮!5 个实战技巧让搜索性能提升 10 倍
大数据·elasticsearch·搜索引擎
星辰_mya20 小时前
Elasticsearch线上问题之OOM
大数据·elasticsearch·搜索引擎
Elastic 中国社区官方博客20 小时前
使用 Groq 与 Elasticsearch 进行智能查询
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
张彦峰ZYF20 小时前
一套「策略化 Elasticsearch 召回平台」架构设计思路
大数据·elasticsearch·搜索引擎
Dxy12393102161 天前
Elasticsearch 索引与映射:为你的数据打造一个“智能仓库”
大数据·elasticsearch·搜索引擎
倒流时光三十年2 天前
SpringBoot 数据库同步 Elasticsearch 性能优化
数据库·spring boot·elasticsearch
星辰_mya2 天前
Elasticsearch更新了分词器之后
大数据·elasticsearch·搜索引擎