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 
相关推荐
daad7772 小时前
USB_抓包
linux·运维·服务器
未来之窗软件服务2 小时前
服务器运维(四十)日服务器linux-ps分析工具—东方仙盟
linux·运维·服务器·服务器运维·仙盟创梦ide·东方仙盟
礼拜天没时间.3 小时前
Docker自动化构建实战:从手工到多阶段构建的完美进化
运维·docker·容器·centos·自动化·sre
Trouvaille ~4 小时前
【Linux】数据链路层与以太网详解:从 MAC 地址到 ARP 的完整指南
linux·运维·服务器·网络·以太网·数据链路层·arp
xiaoliuliu123454 小时前
Xftp-7.0.0109p文件传输安装步骤详解(附FTP/SFTP连接与文件传输教程)
运维·服务器
小鸡食米4 小时前
LVS(Linux Virtual Server)
运维·服务器·网络
罗技1236 小时前
Docker启动Coco AI Server后,如何访问内置Easysearch?
人工智能·docker·容器
DeeplyMind6 小时前
第14章 挂载宿主机目录(Bind Mount)(最常用,重要)
运维·docker·云原生·容器·eureka
DeeplyMind6 小时前
第17章 Docker网络实战与高级管理
网络·docker·容器
FJW0208146 小时前
《Nginx 进阶实战:配置详解、站点发布与常用功能大全》(2)
运维·nginx