码迷,mamicode.com
首页 > 其他好文 > 详细

ElasticSearch 5.5.3 Docker化部署

时间:2018-06-30 23:46:04      阅读:820      评论:0      收藏:0      [点我收藏+]

标签:logs   start   search   cse   arc   /etc/   arch   hub   main   

Dockerfile文件

FROM hub.c.163.com/library/centos
WORKDIR /
COPY entrypoint.sh entrypoint.sh
WORKDIR /opt
MAINTAINER caozhiguang
RUN yum install -y java vim net-tools
COPY elasticsearch-5.5.3.tar.gz elasticsearch-5.5.3.tar.gz
RUN tar zxvf elasticsearch-5.5.3.tar.gz && rm -rf elasticsearch-5.5.3.tar.gz && groupadd admin && useradd admin -g admin && chown -R admin:admin .
RUN echo "network.host: 0.0.0.0" >>elasticsearch-5.5.3/config/elasticsearch.yml
RUN echo "http.port: 9200" >>elasticsearch-5.5.3/config/elasticsearch.yml
RUN echo "cluster.name: my-application" >>elasticsearch-5.5.3/config/elasticsearch.yml
RUN echo "http.cors.enabled: true" >>elasticsearch-5.5.3/config/elasticsearch.yml
RUN echo "http.cors.allow-origin: \"*\"" >>elasticsearch-5.5.3/config/elasticsearch.yml
RUN su admin -c "mkdir -p /opt/elasticsearch-5.5.3/logs && touch /opt/elasticsearch-5.5.3/logs/my-application.log"
RUN echo "vm.max_map_count=655360" >>/etc/sysctl.conf
VOLUME ["/opt"]
EXPOSE 9200
EXPOSE 9300
USER root
ENTRYPOINT ["/bin/sh","/entrypoint.sh"]
HEALTHCHECK --interval=5s --timeout=3s CMD status=`netstat -an | grep -wi listen | grep 9200 | wc -l`;if [ $status eq 1 ]; then echo "0"; else echo "1"; fi

 

entrypoint.sh

su admin -c "sh /opt/elasticsearch-5.5.3/bin/elasticsearch -d"
tail -f /opt/elasticsearch-5.5.3/logs/my-application.log

 

ElasticSearch 5.5.3 启动命令

docker run -it -d --net host --restart always  -v /etc/localtime:/etc/localtime:ro -v /etc/hosts:/etc/hosts:ro  --name  es  192.168.1.3/library/ybles:5.5.3

 

ElasticSearch head 插件启动

docker run  -itd  --name es-head -p 9100:9100 mobz/elasticsearch-head:5

 

ElasticSearch 5.5.3 Docker化部署

标签:logs   start   search   cse   arc   /etc/   arch   hub   main   

原文地址:https://www.cnblogs.com/caozg007/p/9248902.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!