安装ElasticSearch docker-compose时发生无法装载本地卷错误

fzwojiic  于 2022-11-02  发布在  ElasticSearch
关注(0)|答案(1)|浏览(245)

我按照以下步骤设置3 Linux节点集群的ElasticSearch & Kibana使用docker-compose.在这个过程中,当运行命令“docker-compose -f create-certs.yml run --rm create_certs”,得到以下输出错误:

Creating network "es-dev_elastic" with driver "overlay"
Creating volume "es-dev_config" with local driver
Pulling create_certs (docker.elastic.co/elasticsearch/elasticsearch:7.17.6)...
Trying to pull repository docker.elastic.co/elasticsearch/elasticsearch ...
7.17.6: Pulling from docker.elastic.co/elasticsearch/elasticsearch
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
<Some-ID>: Pull complete
Digest: sha256:<Some-ID>
Status: Downloaded newer image for docker.elastic.co/elasticsearch/elasticsearch:7.17.6

**ERROR: Cannot create container for service create_certs: failed to mount local volume: mount /mnt/elasticmount/es11/config:/var/lib/docker/volumes/es-dev_config/_data, flags: 0x1000:                                                 no such file or directory**

在此之前我没有创建任何本地卷装载。所以,如果这是问题所在

如何在Docker中创建和装载目录?

4c8rllxm

4c8rllxm1#

如果我没猜错的话,你想创建3个节点的ElasticSearch和千花。下面我提供了一个docker-compose文件,它将帮助你创建3个节点的ElasticSearch和千花集群。

version: "3"
services:
  kibana:
    container_name: kibana
    image: docker.elastic.co/kibana/kibana:7.16.3
    environment:
      SERVER_NAME: kibana
      ELASTICSEARCH_HOSTS: http://127.0.0.1:9200
    ports:
      - 127.0.0.1:5601:5601
    networks:
      - esnet
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "-Des.logger.level=DEBUG"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 127.0.0.1:9200:9200
    networks:
      - esnet
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    container_name: elasticsearch2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    networks:
      - esnet
  elasticsearch3:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    container_name: elasticsearch3
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata3:/usr/share/elasticsearch/data
    networks:
      - esnet

volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local
  esdata3:
    driver: local

networks:
  esnet:

这将创建3个命名卷(esdata 1、esdata 2、esdata 3),这些卷将在/var/lib/docker/volumes/处创建
如果你遇到任何问题,请告诉我。

相关问题