2

我正在尝试使用 docker-compose 运行 elasticsearch 7.6.0。我收到一个错误。

下面是 docker-compose.yml

version: '2.2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
    container_name: elasticsearch-7
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - http.cors.enabled=true
      - http.cors.allow-origin=*
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - "D:/docker2/elasticsearch/7/data:/usr/share/elasticsearch/data"
    ports:
      - 9200:9200
      - 9300:9300
    command: elasticsearch

错误 :

elasticsearch-7  | ERROR: [1] bootstrap checks failed
elasticsearch-7  | [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  | {"type": "server", "timestamp": "2020-02-13T14:42:51,223Z", "level": "INFO", "component": "o.e.x.m.p.NativeController", "cluster.name": "docker-cluster", "node.name": "node-1", "message": "Native controller process has stopped - no new native processes can be started" }
elasticsearch-7 exited with code 78
4

1 回答 1

4

我想通了,我必须在 docker-compose.yml 下添加以下参数: environment

- node.name=node-1
- cluster.initial_master_nodes=node-1
于 2020-02-13T14:56:37.640 回答