docker-compose 安装部署ElasticSearch 和 Kibana 8.8.1
docker-compose 安装部署ElasticSearch 和 Kibana 8.8.1
一、容器编排脚本(docker-compose.yml)
version: "3.1"
# 服务配置
services:
elasticsearch:
container_name: elasticsearch-8.8.1
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.1
# 用来给容器root权限(不安全)可移除
privileged: true
# 在linux里ulimit命令可以对shell生成的进程的资源进行限制
ulimits:
memlock:
soft: -1
hard: -1
environment:
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- "http.host=0.0.0.0"
- "node.name=elastic01"
- "cluster.name=cluster_elasticsearch"
- "discovery.type=single-node"
ports:
- "9200:9200"
- "9300:9300"
volumes:
# - ./elasticsearch/config:/usr/share/elasticsearch/config
- ./elasticsearch/data:/usr/share/elasticsearch/data
- ./elasticsearch/plugin:/usr/share/elasticsearch/plugins
networks:
- elastic_net
kibana:
container_name: kibana-8.8.1
image: docker.elastic.co/kibana/kibana:8.8.1
ports:
- "5601:5601"
# volumes:
# - ./kibana/config:/usr/share/kibana/config
networks:
- elastic_net
# 网络配置
networks:
elastic_net:
driver: bridge
二、文件挂载
-
启动服务
docker-compose up -d
-
创建文件
# 1.创建 kibana 映射目录
# 2.拷贝 elasticsearch 配置
# 3.拷贝 kibana 配置
mkdir kibana
docker cp elasticsearch-8.8.1:/usr/share/elasticsearch/config ./elasticsearch/config
docker cp kibana-8.8.1:/usr/share/kibana/config ./kibana/config
- elasticsearch配置(config/elasticsearch.yml)
# 集群节点名称
node.name: "elastic01"
# 设置集群名称为elasticsearch
cluster.name: "cluster_elasticsearch"
# 网络访问限制
network.host: 0.0.0.0
# 以单一节点模式启动
discovery.type: single-node
# 是否支持跨域
http.cors.enabled: true
# 表示支持所有域名
http.cors.allow-origin: "*"
# 内存交换的选项,官网建议为true
bootstrap.memory_lock: true
# 修改安全配置 关闭 证书校验
xpack.security.http.ssl:
enabled: false
xpack.security.transport.ssl:
enabled: false
- kibana配置(kibana.yml)
# 中文
i18n.locale: zh-CN
- 放开docker-compose.yml中的注解
- ./elasticsearch/config:/usr/share/elasticsearch/config
- ./kibana/config:/usr/share/kibana/config
# 重启容器
docker compose restart
# 访问地址:
elastic:http://localhost:9200
kibana:http://localhost:5601
- 设置elastic密码
docker exec -it elasticsearch-8.8.1 /usr/share/elasticsearch/bin/elasticsearch-reset-password -uelastic
- 设置kibana密码
docker exec -it elasticsearch-8.8.1 /usr/share/elasticsearch/bin/elasticsearch-reset-password -ukibana_system
- 添加kibana配置
elasticsearch.username: kibana_system
elasticsearch.password: T2nHrowREFI9eGskWSeq
- 获取验证码
docker exec -it kibana-8.8.1 /usr/share/kibana/bin/kibana-verification-code
- 登录kibana
elastic
xxxx kiana密码或elastic密码都OK
来源:https://blog.csdn.net/qq_27895435/article/details/131430040?spm=1001.2014.3001.5502
热门相关:重开地狱 神医嫁到 与校花同居:高手风流 龙组使命 公子风流