elasticsearch6.2.2-ik-kibana集群 docker-compose

一、依赖镜像  

docker.elastic.co/elasticsearch/elasticsearch:6.2.2

docker.elastic.co/kibana/kibana:6.2.2

 

二、镜像添加ik后构建新镜像es622-ik:1.0 .

Dockerfile

FROM docker.elastic.co/elasticsearch/elasticsearch:6.2.2
MAINTAINER sunbin "sunb@citydo.com.cn"

RUN wget -c --tries=0 -O /tmp/elasticsearch-analysis-ik.zip https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip && \
    unzip /tmp/elasticsearch-analysis-ik.zip -d /usr/share/elasticsearch/plugins && \
    rm -rf /tmp/elasticsearch-analysis-ik.zip

构建新镜像

docker build  -t  es622-ik:1.0 .

 

三、根据上一步骤生成的镜像,通过docker-compose  构建启动

docker-compose.yml

version: '2.2'
services:
  elasticsearch:
    image: es622-ik:1.0
    container_name: esearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    restart: always
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 1g
    cap_add:
      - IPC_LOCK
    volumes:
      - $PWD/esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - esnet
  elasticsearch2:
    image: es622-ik:1.0
    container_name: elasticsearch2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    restart: always
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 1g
    cap_add:
      - IPC_LOCK
    volumes:
      - $PWD/esdata2:/usr/share/elasticsearch/esdata1
    networks:
      - esnet
  elasticsearch3:
    image: es622-ik:1.0
    container_name: elasticsearch3
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    restart: always
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 1g
    cap_add:
      - IPC_LOCK
    volumes:
      - $PWD/esdata3:/usr/share/elasticsearch/data
    networks:
      - esnet
  elasticsearch4:
    image: es622-ik:1.0
    container_name: elasticsearch4
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=esearch"
    restart: always
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    mem_limit: 1g
    cap_add:
      - IPC_LOCK
    volumes:
      - $PWD/esdata4:/usr/share/elasticsearch/data
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:6.2.2
    container_name: kibana
    restart: always
    depends_on: 
      - elasticsearch
    environment:
      SERVER_NAME: kibana
      ELASTICSEARCH_URL: http://esearch:9200 
    #volumes:
    # - ./kibana.yml:/usr/share/kibana/config/kibana.yml
    ports:
      - 5601:5601
    networks:
      - esnet
volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local
  esdata3:
    driver: local
  esdata4:
    driver: local
networks:
  esnet:

docker-compose  up -d   启动


ps: 如es启动报/usr/share/elasticsearch/data 没有权限,需要在宿主机 esdata1-4 需要加权限  chmod  777  esdataX

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值