配置文件
version: '2'
services:
# ES
es:
image: elasticsearch:8.6.2
container_name: es
restart: always
ports:
- 9210:9200 #java、集群通信端口
- 9310:9300 #http通信端口
privileged: true #使用privileged设置为true是赋予这个容器root权限
volumes:
- ./es/data:/usr/share/elasticsearch/data
- ./es/logs:/usr/share/elasticsearch/logs
- ./es/plugins:/usr/share/elasticsearch/plugins # ik分词器
environment:
#设置集群名称为elasticsearch
- node.name="es"
- cluster.name="es"
- ES_JAVA_OPTS=-Xms512m -Xmx512m
#以单一节点模式启动
- discovery.type="single-node"
# 关闭xpack认证
- xpack.security.enabled= false
# 与客户端http链接是否加密,先选择不加密
#- xpack.security.http.ssl= false
# - xpack.security.enrollment.enabled=false
# 跨域
# - http.cors.enabled= true
# - http.cors.allow-origin="*"
kibana:
image: kibana:8.6.2
container_name: kibana
restart: always
privileged: true #使用privileged设置为true是赋予这个容器root权限
ports:
- 5611:5601
environment:
# - xpack.security.enabled=false
- xpack.management.enabled= false
- elasticsearch_hosts= ["http://es:9200"]
# kibana中文界面
# - i18n.locale = "zh-CN"
# 设置访问elasticsearch的地址
# - elasticsearch.hosts="http://es:9210"
# - elasticsearch.username="kibana_system"
# - elasticsearch.password="123"
volumes:
- ./kibana/data:/usr/share/kibana/data
- ./kibana/logs:/usr/share/kibana/logs
# depends_on:
# - es
# links:
#可以用es这个域名访问elasticsearch服务
# - es:es
logstash:
image: docker.elastic.co/logstash/logstash:8.6.2
container_name: logstash
restart: always
privileged: true #使用privileged设置为true是赋予这个容器root权限
environment:
- xpack.management.enabled= false
- xpack.monitoring.elasticsearch.hosts= "http://es:9200"
# - xpack.monitoring.elasticsearch.username= "logstash_system"
# - xpack.monitoring.elasticsearch.password= "123"
ports:
- 4560:4560
kibana
1、浏览器访问 http://localhost:5611/
2、选择手动配置输入 http://es:9200(必须使用服务名称和服务端口,ip地址,localhost都不行)
3、获取验证码,进入kibana容器,执行./bin/kibana-verification-code
4、完成配置