简体   繁体   English

Docker:在容器外为 ElasticSearch 和 Mongo 持久化数据

[英]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.所以我对 Docker (Docker compose) 还是很陌生,我正在尝试用容器替换我在 Ubuntu 16.04 上的当前设置。 So I had Elasticsearch and MongoDB installed.所以我安装了 Elasticsearch 和 MongoDB。 Elasticsearch wrote data to /fast/elasticsearch (SSD) and MongoDB wrote data to /data/mongodb (8TB disk) Elasticsearch 写数据到/fast/elasticsearch(SSD),MongoDB 写数据到/data/mongodb(8TB 磁盘)

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/所以我试图用 Docker-Compose 做同样的事情,我认为我对 Mongo 来说是正确的,但我无法让 ElasticSearch 写入 /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'版本:'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.使用 mongo 的方式与 elasticsearch 的工作方式相同。 or maybe I don't get your issue或者我不明白你的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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