简体   繁体   中英

Docker : persisting data outside of containers for ElasticSearch and Mongo

So I am fairly new to Docker (Docker compose) and I am trying to replace my current setup on Ubuntu 16.04 with containers. So I had Elasticsearch and MongoDB installed. Elasticsearch wrote data to /fast/elasticsearch (SSD) and MongoDB wrote data to /data/mongodb (8TB disk)

So I am trying to do the same with Docker-Compose, I think I have it right for Mongo but I cant get ElasticSearch to write to /fast/

version: '3.2'

services:
  elasticsearch:
    build:
      context: elasticsearch/
      args:
        ELK_VERSION: $ELK_VERSION
    volumes:
      - type: bind
        source: ./elasticsearch/config/elasticsearch.yml
        target: /usr/share/elasticsearch/config/elasticsearch.yml
      - type: volume
        source: elasticsearch
        target: ./fast/elasticsearch

    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx2048m -Xms2048m"
      discovery.type: single-node
    networks:
      - skynet

  mongo:
    image: mongo:latest
    restart: always
    volumes:
       - ./data/mongodb:/data/db
    ports:
      - "27017:27017"
    networks:
      - skynet

  burf:
    image: burf2000/burf-search-azure:v1.0.0
    restart: always
    ports:
      - "8888:80"
    networks:
        - skynet

networks:
  skynet:
    driver: bridge

volumes:
  elasticsearch:

version: '3.2'

services:
  elasticsearch:
    volumes:
      ...
      - /fast/elasticsearch:/path/your/setup/on/your/config
      # /host/absolute/path:/container/absolute/path

The way you make it work with mongo works the same way for elasticsearch. or maybe I don't get your issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM