1. 版本
Elasticsearch:7.10.2
Kibana:7.10.2
2. 修改Elasticsearch密码
2.1修改配置
修改 elasticsearch.yml ,加上以下配置项:
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
然后重启ES服务
2.2 设置密码
切换到 ${ES_HOME}/bin 目录下,执行命令:./elasticsearch-setup-passwords interactive
先输入 y 确认修改密码, 然后根据提示输入每个账号的密码即可
[es@localhost bin]$ ./elasticsearch-setup-passwords interactive
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]
[es@localhost bin]$
2.3 修改指定账号的密码
例如:把 elastic 密码改成 123456
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://192.168.25.131:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'
执行之后,输入一遍原始密码,即可以成功修改成新的密码了。
3. 修改Kibana配置
找到 kibana.yml,修改以下配置项:
然后重启 kibana 即可