Elasticsearch+Docker-Compose实现docker化ES部署
首先需要安装docker:具体安装方式不再赘述,详细可看docker官网攻略。docker安装成功后安装docker-compose。随后在文件夹中放入docker-compose.yml文件,在cmd或者terminal中执行docker-compose up命令:附docker-compose文件如下:version: '2.2'services:elasti...
·
首先需要安装docker:
具体安装方式不再赘述,详细可看docker官网攻略。
docker安装成功后安装docker-compose。
随后在文件夹中放入docker-compose.yml文件,在cmd或者terminal中执行docker-compose up命令:
附docker-compose文件如下:
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.5.4
container_name: elasticsearch
environment:
- cluster.name=my-application
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200:9200
- 9300:9300
networks:
- esnet
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:6.5.4
container_name: elasticsearch2
environment:
- cluster.name=my-application
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- "discovery.zen.ping.unicast.hosts=elasticsearch"
ulimits:
memlock:
soft: -1
hard: -1
networks:
- esnet
kibana:
image: docker.elastic.co/kibana/kibana:6.5.4
# volumes:
# - ./kibana.yml:/usr/share/kibana/config/kibana.yml
environment:
- ELASTICSEARCH_URL=http://elasticsearch:9200
ports:
- "5601:5601"
networks:
- esnet
volumes:
esdata1:
driver: local
esdata2:
driver: local
networks:
esnet:
期间遇到的问题:
解决方法:
在终端输入:curl -XDELETE localhost:9200/.kibana_1
删除 .kibana_1这个index,重启docker-compose服务
- kibana无法连接节点:原因是elasticsearch之前有kibana的index,进入es将kibana的index删除就可以了。
更多推荐
已为社区贡献1条内容
所有评论(0)