ubuntu22.04 docker安装ES8

创建es的网络

docker network create elastic

安装运行es

docker run --name es01 --net elastic -p 9200:9200 -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -idt elasticsearch:8.2.2

检查是否安装成功

sunyuhua@sunyuhua-HKF-WXX:~$ docker ps
CONTAINER ID   IMAGE                     COMMAND                   CREATED          STATUS         PORTS                                                                                                                                      NAMES
213c6e518a18   elasticsearch:8.2.2       "/bin/tini -- /usr/l…"   10 minutes ago   Up 3 seconds   0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 9300/tcp                                                                                        es01
519916b1d75c   ankane/pgvector:latest    "docker-entrypoint.s…"   2 weeks ago      Up 12 hours    0.0.0.0:5432->5432/tcp, :::5432->5432/tcp                                                                                                  pgvector
9e9de3dd5925   careywong/subweb:latest   "/docker-entrypoint.…"   6 weeks ago      Up 12 hours    0.0.0.0:58080->80/tcp, :::58080->80/tcp                                                                                                    subweb
135c04fb8903   nacos/nacos-server        "bin/docker-startup.…"   2 months ago     Up 12 hours    0.0.0.0:8848->8848/tcp, :::8848->8848/tcp, 0.0.0.0:9848-9849->9848-9849/tcp, :::9848-9849->9848-9849/tcp                                   nacos
a4f62467a17b   redis                     "docker-entrypoint.s…"   2 months ago     Up 12 hours    0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                                                                  redis
0aab04fb09da   zookeeper                 "/docker-entrypoint.…"   2 months ago     Up 12 hours    2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp, :::2181->2181/tcp, 8080/tcp                                                                    zookeeper
374d2a440886   rabbitmq                  "docker-entrypoint.s…"   2 months ago     Up 12 hours    4369/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp   rabbitmq
37c420bc27ec   mysql                     "docker-entrypoint.s…"   2 months ago     Up 12 hours    0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                                                                                       mysql

使用https命令登陆,注意不是http登陆

https://127.0.0.1:9200/

进入容器获取用户名和密码

sunyuhua@sunyuhua-HKF-WXX:~$ docker exec -it es01 /bin/bash
elasticsearch@213c6e518a18:~$ ls
LICENSE.txt  NOTICE.txt  README.asciidoc  bin  config  data  jdk  lib  logs  modules  plugins
elasticsearch@213c6e518a18:~$ cd bin
elasticsearch@213c6e518a18:~/bin$ ks
bash: ks: command not found
elasticsearch@213c6e518a18:~/bin$ elasticsearch-reset-password -u elastic
WARNING: Owner of file [/usr/share/elasticsearch/config/users] used to be [root], but now is [elasticsearch]
WARNING: Owner of file [/usr/share/elasticsearch/config/users_roles] used to be [root], but now is [elasticsearch]
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: kLRzlNzzucGAofrS6xt7

用户名:elastic
密码:kLRzlNzzucGAofrS6xt7

在这里插入图片描述

安装kibana进行管理

sunyuhua@sunyuhua-HKF-WXX:~$ docker run \
--name kibana \
--net elastic \
-p 5601:5601 \
-idt kibana:8.2.2
Unable to find image 'kibana:8.2.2' locally
8.2.2: Pulling from library/kibana
d5fd17ec1767: Already exists 
0e13695e6282: Pull complete 
f4c86adffcb8: Pull complete 
37df8a7a2f1c: Pull complete 
605b30158b0c: Pull complete 
4f4fb700ef54: Pull complete 
8789a463d8bc: Pull complete 
6c1b4670a98a: Pull complete 
787921eb6497: Pull complete 
7833e8f6b5e0: Pull complete 
60937e7413ca: Pull complete 
a04fb33dd003: Pull complete 
5fcdf8cb4a0b: Pull complete 
929af379dbc3: Pull complete 
Digest: sha256:cf34801f36a2e79c834b3cdeb0a3463ff34b8d8588c3ccdd47212c4e0753f8a5
Status: Downloaded newer image for kibana:8.2.2
f073cde5c95817867db19ba5326db59c19b91a62eedd343149aa323b7e9924f8

浏览器登陆kibana

http://localhost:5601/app/integrations/browse

获取登陆需要的token

sunyuhua@sunyuhua-HKF-WXX:~$ docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
eyJ2ZXIiOiI4LjIuMiIsImFkciI6WyIxNzIuMjEuMC4yOjkyMDAiXSwiZmdyIjoiNzliNzZmZjQzYmJkOTRhNjYyNDY0YWU5ODY5ZjQzZDA4OTFlMjRjNTVlYWFlOTc5NjM5MjJkZjcxOTU3YTNkYiIsImtleSI6Ild2Ukxab3dCWW03dU9zZGx0WWxmOjU1UFplWXRMUzRXVFZKV2UydEw5MFEifQ==

获取登陆需要的验证码

sunyuhua@sunyuhua-HKF-WXX:~$ docker exec -it kibana bin/kibana-verification-code
Your verification code is:  944 164 

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/sunyuhua_keyboard/article/details/134990953