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 
相关推荐
Java陈序员1 天前
轻量强大!一款现代化的 Kubernetes 集群管理与监控工具!
云原生·容器·kubernetes
爱吃橘子橙子柚子2 天前
3CPU性能排查总结(超详细)【Linux性能优化】
运维·cpu
Sheffield3 天前
Docker的跨主机服务与其对应的优缺点
linux·网络协议·docker
Sheffield3 天前
Alpine是什么,为什么是Docker首选?
linux·docker·容器
马艳泽3 天前
win10下运行Start Broker and Proxy报错解决
docker
舒一笑4 天前
程序员效率神器:一文掌握 tmux(服务器开发必备工具)
运维·后端·程序员
NineData4 天前
数据库管理工具NineData,一年进化成为数万+开发者的首选数据库工具?
运维·数据结构·数据库
用户13573999256604 天前
Windows 从 0 搭建 WSL2 原生 AI 开发环境:Codex + Docker + VSCode
docker
vi_h4 天前
在 macOS 上通过 Docker 安装并运行 Ollama(详细可执行教程)
macos·docker·ollama
黑心老魔4 天前
通过 Docker 创建开发环境
docker·开发环境