docker运行elastic和kibana,并使用密码连接

1. elasticsearch

  • 运行容器
bash 复制代码
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.7.0 
  • 进入容器
bash 复制代码
docker exec -it elasticsearch bash
  • 修改配置开启密码校验
bash 复制代码
vi ./conf/elasticsearch.yml
  • 添加以下内容
bash 复制代码
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
  • 退出容器
bash 复制代码
exit 
  • 重启容器
bash 复制代码
docker restart elasticsearch 
  • 进入容器
bash 复制代码
docker exec -it elasticsearch bash
  • 生成自定义密码
bash 复制代码
./bin/elasticsearch-setup-passwords interactive
  • 退出容器
bash 复制代码
exit 
  • 访问以下链接 ,输入账号和密码
    http://ip:9200
    ps: ip修改为自己的虚机ip

2. kibana

  • 运行容器
bash 复制代码
docker run --name kibana -d --link elasticsearch:elasticsearch -p 5601:5601 kibana:7.7.0

ps: elasticsearch:elasticsearch中的前者为容器名称

  • 进入容器
bash 复制代码
docker exec -it kibana bash
  • 修改配置,设置elasticsearch的密码
bash 复制代码
vi ./config/kibana.yml
  • 添加以下内容
bash 复制代码
server.name: kibana
server.host: "0.0.0.0"
elasticsearch.hosts: [ "http://elasticsearch:9200" ]
monitoring.ui.container.elasticsearch.enabled: true
elasticsearch.username: "elastic"
elasticsearch.password: "123456"
i18n.locale: "zh-CN"

ps: password修改为elasticsearch的密码

  • 退出容器
bash 复制代码
exit
  • 重启容器
bash 复制代码
docker restart kibana
  • 访问以下链接 ,输入账号和密码
    http://ip:5601
    ps: ip修改为自己的虚机ip
相关推荐
浅念-15 分钟前
一文吃透Git:本地操作|冲突处理|远程协作|GitFlow工作流详解
大数据·git·elasticsearch·搜索引擎·gitflow
vx-程序开发6 小时前
【计算机毕设】基于Spring Boot的古城景区管理系统88564
java·数据库·spring boot·后端·spring·elasticsearch·课程设计
czhc11400756636 小时前
2026-09-11 一日综合:树的父链、git 概念、三方死锁、静默失败
大数据·git·elasticsearch
Elastic 中国社区官方博客1 天前
Elasticsearch 向量数据库:几分钟内完成部署,以经济高效的方式扩展至数千亿规模
大数据·运维·数据库·elasticsearch·搜索引擎·ai·全文检索
Elasticsearch2 天前
将 Vercel 数据导入 Elastic:无需安装任何东西的无服务器可观测性
elasticsearch
Elastic 中国社区官方博客2 天前
Elasticsearch Python DSL 客户端开发
大数据·数据库·python·elasticsearch·搜索引擎·全文检索
阿里云大数据AI技术2 天前
Al Search x ES Agent Builder:让数据活起来,从搜索走向行动
人工智能·elasticsearch·agent
Elasticsearch2 天前
Elastic Agent Builder 中能够引用证据的 AI 根因分析
elasticsearch
考虑考虑2 天前
elasticSearch中的element_type
运维·后端·elasticsearch