赞
踩
- TAKE_FILE_OWNERSHIP=true #允许挂载,不然es容器启动不了
- version: '3'
- services:
- elasticsearch:
- image: elasticsearch:6.8.8
- container_name: elasticsearch6
- environment:
- - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
- - "discovery.type=single-node" #以单一节点模式启动
- - "ES_JAVA_OPTS=-Xms4096m -Xmx4096m" #设置使用jvm内存大小
- - TAKE_FILE_OWNERSHIP=true #允许挂载,不然es容器启动不了
- volumes:
- - /data/elasticsearch6/plugins:/usr/share/elasticsearch/plugins #插件文件挂载
- - /data/elasticsearch6/data:/usr/share/elasticsearch/data #数据文件挂载
- - /data/elasticsearch6/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml #配置文件挂载
- ports:
- - 9200:9200
- - 9300:9300
- kibana:
- image: kibana:6.8.8
- container_name: kibana6
- depends_on:
- - elasticsearch #kibana在elasticsearch启动之后再启动
- environment:
- - "elasticsearch.hosts=http://127.0.0.1:9200" #设置访问elasticsearch的地址
- volumes:
- - /data/kibana6/config:/usr/share/kibana/config #配置文件挂载
- ports:
- - 5601:5601
下面是elasticsearch和kibana的配置文件,放到对应的路径
- cat elasticsearch.yml
-
- cluster.name: "docker-cluster"
- node.name: node-1
- network.host: 0.0.0.0
- http.port: 9200
- cat kibana.yml
-
- server.name: kibana
- server.host: "0"
- elasticsearch.hosts: [ "http://elasticsearch:9200" ]
- i18n.locale: "zh-CN"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。