ES和kibana 小白快速体验启动服务
ES和kibana 小白快速体验启动服务
懒人必备,节约时间,珍惜生命。
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.16.0 docker pull docker.elastic.co/kibana/kibana:8.16.0 docker network create elastic docker run -d --name es01 --net elastic -p 9200:9200 -m 1GB -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:8.16.0
docker exec -it es01 /bin/bash -c "echo y | /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic"
返回值中包含 elastic 用户的密码
docker run -d --name kib01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.16.0
docker exec -it es01 /bin/bash -c "echo y | /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana"
返回值全部复制,输入 http://localhost:5601的提示框内
docker exec -it kib01 /usr/share/kibana/bin/kibana-verification-code
返回验证code
依次输入上述的登录密码,开始使用吧~~
拉取镜像
docker pull docker.elastic.co/elasticsearch/elasticsearch:8.16.0 docker pull docker.elastic.co/kibana/kibana:8.16.0
创建ES容器服务
docker run -d --name es01 --net elastic -p 9200:9200 -m 1GB -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:8.16.0
重置管理员密码(用户名:elastic)
- 交互的方式
[root@iZ2zed6sjlcuvri772ijmcZ ~]# docker exec -it es01 /bin/bash elasticsearch@1da00c4ea629:~$ /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic This tool will reset the password of the [elastic] user to an autogenerated value. The password will be printed in the console. Please confirm that you would like to continue [y/N]y Password for the [elastic] user successfully reset. New value: lA12ya-YzZOdCucPJp4W
- 免交互
[root@iZ2zed6sjlcuvri772ijmcZ ~]# docker exec -it es01 /bin/bash -c "echo y | /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic" This tool will reset the password of the [elastic] user to an autogenerated value. The password will be printed in the console. Please confirm that you would like to continue [y/N] Password for the [elastic] user successfully reset. New value: v3wrbtmsHUc*hOoz1f+z
服务器内验证访问
[root@iZ2zed6sjlcuvri772ijmcZ ~]# docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
Successfully copied 3.58kB to /root/.
[root@iZ2zed6sjlcuvri772ijmcZ ~]# export ELASTIC_PASSWORD='v3wrbtmsHUc*hOoz1f+z';curl --cacert http_ca.crt -u elastic:$ELASTIC_PASSWORD https://localhost:9200
{
"name" : "1da00c4ea629",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "nIxIZRkTTHCMRKBRO9l3Dg",
"version" : {
"number" : "8.16.0",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "12ff76a92922609df4aba61a368e7adf65589749",
"build_date" : "2024-11-08T10:05:56.292914697Z",
"build_snapshot" : false,
"lucene_version" : "9.12.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
创建Kibana镜像
docker run -d --name kib01 --net elastic -p 5601:5601 docker.elastic.co/kibana/kibana:8.16.0
配置连接
[root@iZ2zed6sjlcuvri772ijmcZ ~]# docker exec -it es01 /bin/bash -c "echo y | /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana"
eyJ2ZXIiOiI4LjE0LjAiLCJhZHIiOlsiMTcyLjE5LjAuMjo5MjAwIl0sImZnciI6IjMyY2Y0ODBjNzU1NTMyMjcwNzk5NTQyNTMwY2JiMGVkY2Q4YTU1MDViODIyYWIwMzg5YjAwNTFmMjVmNGViYjkiLCJrZXkiOiJOZnN3S3BNQnM5QmxubVRXem9McjprSG41SEEwWFRoTzY1eWZfR21Ga3V3In0=
[root@iZ2zed6sjlcuvri772ijmcZ ~]# docker exec -it kib01 /usr/share/kibana/bin/kibana-verification-code Kibana is currently running with legacy OpenSSL providers enabled! For details and instructions on how to disable see https://www.elastic.co/guide/en/kibana/8.16/production.html#openssl-legacy-provider Your verification code is: 812 855
复制上述蓝色的token,如下图。
密码为上述重置的密码
用户:elastic
密码:v3wrbtmsHUc*hOoz1f+z