一、ElasticSearch设置密码
关闭ES,修改D:\ProgramFiles\elasticsearch-7.9.2\config\elasticsearch.yml配置文件
http.cors.enabled: true http.cors.allow-origin: "*" # elasticsearch-head配置需要添加此配置 http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type xpack.security.enabled: true xpack.security.transport.ssl.enabled: true
在bin目录下运行cmd,修改密码:
elasticsearch-setup-passwords interactive
如果提示: future versions of Elasticsearch will require Java 11解决方法
修改D:\ProgramFiles\elasticsearch-7.9.2\bin\elasticsearch-env.bat
用自己的esjdk路径
if defined JAVA_HOME ( set JAVA="D:\ProgramFiles\elasticsearch-7.9.2\jdk\bin\java.exe" ) else ( set JAVA="D:\ProgramFiles\elasticsearch-7.9.2\jdk\bin\java.exe" set JAVA_HOME="D:\ProgramFiles\elasticsearch-7.9.2\jdk" )
重新修改密码
重启后验证
访问
http://localhost:9200/
弹框输入账号密码
二、elasticsearch-head
http://127.0.0.1:9100/?auth_user=elastic&auth_password=密码
三、kibana配置
打开 kibana下的config\kibana.yml
#添加以下内容 elasticsearch.username: "elastic" elasticsearch.password: "elastic"