使用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即可

 

posted @ 2020-01-13 16:37  Ninon  阅读(7408)  评论(0编辑  收藏  举报