Elasticsearch密码验证

Posted l_learning

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch密码验证相关的知识,希望对你有一定的参考价值。

es7.0版本安装包带了xpack功能

修改配置

在elasticsearch.yml添加如下配置

xpack.security.enabled: true
#加密方式
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true

重启es

以后台方式运行

./elasticsearch -d

设置密码

./elasticsearch-setup-passwords interactive

根据提示输入密码

warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME
Future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/java/jdk1.8.0_201/jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
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]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana_system]: 
Reenter password for [kibana_system]: 
Enter password for [logstash_system]: 
Reenter password for [logstash_system]: 
Enter password for [beats_system]: 
Reenter password for [beats_system]: 
Enter password for [remote_monitoring_user]: 
Reenter password for [remote_monitoring_user]: 
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]


使用http调用的方式
https://www.base64decode.org/网站进行加密
添加请求头Authorization,password值为加密后的密码(Basic password)

以上是关于Elasticsearch密码验证的主要内容,如果未能解决你的问题,请参考以下文章

Express实战 - 应用案例- realworld-API - 路由设计 - mongoose - 数据验证 - 密码加密 - 登录接口 - 身份认证 - token - 增删改查API(代码片段

elasticsearch代码片段,及工具类SearchEsUtil.java

Elasticsearch 设置用户名密码认证(亲测)

Elasticsearch 设置用户名密码认证(亲测)

Elasticsearch设置密码

使用密码验证后弹性搜索`无法建立连接,因为目标机器主动拒绝`