参考官方网站的说明文档:
https://www.elastic.co/guide/en/elastic-stack-overview/6.7/elasticsearch-security.html
首先,打开ElasticSearch的安全策略:
参考:https://www.elastic.co/guide/en/elastic-stack-overview/6.7/get-started-enable-security.html
编辑elasticsearch.yml文件,添加如下行
xpack.security.enabled: true
设置内置用户的密码:
参考:https://www.elastic.co/guide/en/elastic-stack-overview/6.7/get-started-built-in-users.html
在命令行输入:
./bin/elasticsearch-setup-passwords interactive
D:\ELK\elasticsearch-7.3.1\bin>elasticsearch-setup-passwords interactive
future versions of Elasticsearch will require Java 11; your Java version from [C:\Program Files\Java\jdk1.8.0_191\jre] does not meet this requirement
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,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]: <--输入用户elastic的密码,要牢记!>
Reenter password for [elastic]: <--再次输入你定义的密码>
Enter password for [apm_system]: <--输入用户apm_system的密码,要牢记!>
Reenter password for [apm_system]: <--再次输入你定义的密码>
Enter password for [kibana]: <--输入用户kibana的密码,要牢记!>
Reenter password for [kibana]: <--再次输入你定义的密码>
Enter password for [logstash_system]: <--输入用户logstash_system的密码,要牢记!>
Reenter password for [logstash_system]: <--再次输入你定义的密码>
Enter password for [beats_system]: <--输入用户beats_system的密码,要牢记!>
Reenter password for [beats_system]: <--再次输入你定义的密码>
Enter password for [remote_monitoring_user]: <--输入用户remote_monitoring_user的密码,要牢记!>
Reenter password for [remote_monitoring_user]: <--再次输入你定义的密码>
Changed password for user [apm_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]
D:\ELK\elasticsearch-7.3.1\bin>
重启ElasticSearch
配置kibana用密码访问Elasticsearch
参考:https://www.elastic.co/guide/en/elastic-stack-overview/6.7/get-started-kibana-user.html
打开Kibana的配置文件kibana.yml,添加下面两行
elasticsearch.username: "kibana" #注意,这里只能是kibana>
elasticsearch.password: "刚才给Kibana设置的密码"
重启kibana
登录kibana
Kibana启动后,再打开Kibana主页你会发现需要输入用户名和密码了。
这里注意,管理员是elastic,密码是你刚才设置的密码。
用户管理界面就粗现了~~~