用于elasticsearch 7.0.1和kibana 7.0.1的docker-compose.yml [英] docker-compose.yml for elasticsearch 7.0.1 and kibana 7.0.1
问题描述
我在Windows 10上将Docker Desktop与linux容器一起使用,并希望在docker撰写文件上启动最新版本的elasticsearch和kibana容器。
I am using Docker Desktop with linux containers on Windows 10 and would like to launch the latest versions of the elasticsearch and kibana containers over a docker compose file.
一切在使用某些较旧的版本(如6.2.4)时可以正常工作。
Everything works fine when using some older version like 6.2.4.
这是6.2.4的有效docker-compose.yml文件。
This is the working docker-compose.yml file for 6.2.4.
version: '3.1'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
container_name: elasticsearch
ports:
- "9200:9200"
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
networks:
- docker-network
kibana:
image: docker.elastic.co/kibana/kibana:6.2.4
container_name: kibana
ports:
- "5601:5601"
depends_on:
- elasticsearch
networks:
- docker-network
networks:
docker-network:
driver: bridge
volumes:
elasticsearch-data:
我删除了所有已安装的Docker容器并通过将6.2.4更改为7.0.1修改了docker-compose.yml文件。
通过启动新的compose文件,一切看起来都很好,启动了elasticsearch和kibana容器。但是几秒钟后,elasticsearch容器退出了(kibana容器正在运行)。我重新启动了所有程序,将终端连接到了Elasticsearch容器,并看到以下错误消息:
I deleted all installed docker containers and adapted the docker-compose.yml file by changing 6.2.4 to 7.0.1. By starting the new compose file everything looks fine, both the elasticsearch and kibana containers are started. But after a couple of seconds the elasticsearch container exits (the kibana container is running further). I restarted everything, attached a terminal to the elasticsearch container and saw the following error message:
...
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
...
要使Elasticsearch 7.0.1正常工作,必须在docker-compose.yml文件中进行哪些更改?
What must be changed in the docker-compose.yml file to get elasticsearch 7.0.1 working?
推荐答案
进行一些更改对我有用-
Making a few changes worked for me -
-
添加
cluster.initial_master_nodes
撰写Elasticsearch服务-
Add
cluster.initial_master_nodes
to the elasticsearch service in compose -
environment:
- cluster.initial_master_nodes=elasticsearch
vm.max_map_count
至少设置为262144-
vm.max_map_count
on the linux box kernel setting needs to be set to at least 262144 -
$ sudo sysctl -w vm.max_map_count=262144
对于开发模式,您也可以使用以下设置-
For development mode, you can use below settings as well -
environment:
- discovery.type=single-node
为我工作的文件-
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
container_name: es01
environment:
- cluster.initial_master_nodes=es01
ulimits:
memlock:
soft: -1
hard: -1
ports:
- 9200
对于生产模式,您必须考虑按照官方文档中的建议使用多个ES节点/容器
For production mode, you must consider having multiple ES nodes/containers as suggested in the official documentation
这篇关于用于elasticsearch 7.0.1和kibana 7.0.1的docker-compose.yml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!