基于 Docker 搭建 Elasticsearch + Kibana 环境

一、Elasticsearch

1. 下载镜像

elasticsearch镜像不支持latest标签,必须指定版本号

bash 复制代码
% docker pull elasticsearch:8.17.2

2. 启动容器

参考官方文档 https://www.elastic.co/guide/en/elasticsearch/reference/7.5/docker.html

bash 复制代码
% docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:8.17.2

3. 无法启动

bash 复制代码
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGILL (0x4) at pc=0x0000ffff7413ff68, pid=26, tid=27
#
# JRE version:  (22.0.2+9) (build )
# Java VM: OpenJDK 64-Bit Server VM (22.0.2+9-70, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# j  java.lang.System.registerNatives()V+0 java.base@22.0.2
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid26.log
[0.013s][warning][os] Loading hsdis library failed
#
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
/usr/share/elasticsearch/bin/elasticsearch-env: line 83:    26 Aborted                 "$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker

4. 解决方法

参考 https://github.com/elastic/elasticsearch/issues/118583#issuecomment-2567270484

bash 复制代码
% docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "_JAVA_OPTIONS=-XX:UseSVE=0" elasticsearch:8.17.2

二、Kibana

1. 下载镜像

bash 复制代码
% docker pull kibana:8.17.2

2. 启动容器

bash 复制代码
% docker run -p 5601:5601 kibana:8.17.2

三、访问网页

1. 浏览器访问

localhost:5601

2. 生成 Enrollment token

bash 复制代码
% docker exec -it container_name /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

Picked up _JAVA_OPTIONS: -XX:UseSVE=0
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]
eyJ2ZXIiOiI4LjE0LjAiLCJhZHIiOlsiMTcyLjE3LjAuNTo5MjAwIl0sImZnciI6IjhhYTdjZDdjNDg5NjgyYzlhMjU4ZmFkNjk0MzIzYWI2ZjRiNDUwZWRjMGE1ZGM0NjAwMGViNGZhYmMyZmM4ZTkiLCJrZXkiOiItc0tlLXBRQnVwZjNRa2kxWHlwLTpfNGo3VDhvLVI2ZUhrdlJzMjBPUGhBIn0=

3. 生成密码

bash 复制代码
% docker exec -it container_name /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic

Picked up _JAVA_OPTIONS: -XX:UseSVE=0
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: _4Pfdz8+3wOXaXx2ULor
相关推荐
TM1Club5 小时前
AI驱动的预测:新的竞争优势
大数据·人工智能·经验分享·金融·数据分析·自动化
zhang133830890755 小时前
CG-09H 超声波风速风向传感器 加热型 ABS材质 重量轻 没有机械部件
大数据·运维·网络·人工智能·自动化
电商API_180079052477 小时前
第三方淘宝商品详情 API 全维度调用指南:从技术对接到生产落地
java·大数据·前端·数据库·人工智能·网络爬虫
龙山云仓7 小时前
No140:AI世间故事-对话康德——先验哲学与AI理性:范畴、道德律与自主性
大数据·人工智能·深度学习·机器学习·全文检索·lucene
躺柒8 小时前
读数字时代的网络风险管理:策略、计划与执行04风险指引体系
大数据·网络·信息安全·数字化·网络管理·网络风险管理
啦啦啦小石头8 小时前
Docker 换源
docker
独自归家的兔10 小时前
从 “局部凑活“ 到 “全局最优“:AI 规划能力的技术突破与产业落地实践
大数据·人工智能
海域云-罗鹏10 小时前
国内公司与英国总部数据中心/ERP系统互连,SD-WAN专线实操指南
大数据·数据库·人工智能
策知道11 小时前
依托政府工作报告准备省考【经验贴】
大数据·数据库·人工智能·搜索引擎·政务
Henry-SAP11 小时前
SAP(ERP) 组织结构业务视角解析
大数据·人工智能·sap·erp·sap pp