使用docker-compose快速搭建本地ElasticSearch7和Elastichd環境


先編寫docker-compose.es.yml

version: '3'
services:
  elasticsearch:
    image: elasticsearch:7.5.1
    container_name: elasticsearch
    networks:
    - net-es
    volumes:
    - ../data/elasticsearch/data:/usr/share/elasticsearch/data  #這里將elasticsearch的數據文件映射本地,以保證下次如果刪除了容器還有數據
    environment:
    - discovery.type=single-node
    ports:
    - "9200:9200"

  elastichd:
    image: containerize/elastichd:latest
    container_name: elasticsearch-hd
    networks:
    - net-es
    ports:
      - "9800:9800"
    depends_on:
      - "elasticsearch"
    links:
      - "elasticsearch:demo"

#這里要注意,es和eshd要在相同網絡才能被links
networks:
  net-es:
    external: false

啟動代碼:

docker-compose -f docker-compose.es.yml up

啟動后訪問http://localhost:9800打開elastichd

輸入elasticsearch地址點connect即可

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM