ubuntu22.04 docker安装ES8

创建es的网络

bash 复制代码
docker network create elastic

安装运行es

bash 复制代码
docker run --name es01 --net elastic -p 9200:9200 -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -idt elasticsearch:8.2.2

检查是否安装成功

bash 复制代码
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/

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

bash 复制代码
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进行管理

bash 复制代码
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

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

获取登陆需要的验证码

bash 复制代码
sunyuhua@sunyuhua-HKF-WXX:~$ docker exec -it kibana bin/kibana-verification-code
Your verification code is:  944 164 
相关推荐
汀、人工智能24 分钟前
修改Docker默认存储路径,解决系统盘占用90%+问题(修改docker root dir)
docker·容器
吃面不喝汤661 小时前
如何配置和使用自己的私有 Docker Registry
运维·docker·容器
Rookie_explorers1 小时前
Linux下go环境安装、环境配置并执行第一个go程序
linux·运维·golang
学习向前冲1 小时前
AD域控服务器
运维·服务器
Leighteen1 小时前
Docker常用命令
docker·容器
hgdlip1 小时前
查看ip地址的方法有几种?探索多样方法
运维·服务器·ip地址
丶21361 小时前
【Nginx】在 Docker 上安装 Nginx 的详细指南
运维·nginx·docker
codelife3212 小时前
在Docker容器中执行命令
容器
神即道 道法自然 如来2 小时前
Jenkins怎么设置每日自动执行构建任务?
运维·jenkins
petaexpress2 小时前
常用的k8s容器网络模式有哪些?
网络·容器·kubernetes