1.安装2.启动elasticsearch生成令牌kibana验证登录elasticsearch
1.安装前言
8.0中新功能使用8.0版本的最好先看下。
docker pull elasticsearch:8.0.0docker pull kibana:8.0.0
2.启动 启动elasticsearch、kibana
可以参考另一篇博客[docker安装kibana]、docker安装elasticSearch和head插件(https://blog.csdn.net/IT_road_qxc/article/details/121856640)
安装完毕后,挂载外部卷启动。
我这里已经安装并配置过了,直接启动容器。
docker start elasticsearch8docker start kibana8
查看kibana是否启动成功。
访问 ip:5601
进入elasticsearch容器中生成令牌
# 进入容器docker exec -it elasticsearch8 /bin/bash# 生成令牌 令牌由30分钟有效期bin/elasticsearch-create-enrollment-token --scope kibana
kibana验证# 进入kibana容器中docker exec -it kibana8 /bin/bash# 执行生成验证码命令bin/kibana-verification-code # 获得的验证码输入之前页面中Your verification code is: 341 246
输入生成验证码点击验证
到这步算是elasticsearch和kiban8.0自动配置用户名密码验证完成。心细的小伙伴肯定发现kibana.yml与之前的不一样了。
文档中介绍:
If you need to reset the password for the elastic user or other built-in users, run the elasticsearch-reset-password tool、This tool is available in the Elasticsearch /bin directory of the Docker container.
既然知道了咋做了,直接执行即可。
# 进入elastic容器中docker exec -it elasticsearch8 /bin/bash# 重置密码bin/elasticsearch-reset-password --username elastic -i
运行结果:
elasticsearch@ca58f3f716bf:~$ bin/elasticsearch-reset-password -u elastic -iThis tool will reset the password of the [elastic] user.You will be prompted to enter the password.Please confirm that you would like to continue [y/N]yEnter password for [elastic]: Re-enter password for [elastic]: Password for the [elastic] user successfully reset.
再次登录kibana页面,登录成功。