Make an ElasticSearch cluster image

Download the elastic search installation package

elasticsearch-6.1.3.tar.gz

Download the jdk installation package

jdk-8u261-linux-x64.tar.gz

Modify elasticsearch configuration file

pathconfig/elasticsearch.yml

  1. Keep the cluster.name of multiple nodes consistent to confirm that they are the same cluster
cluster.name: datasong
  1. The node.name of each node is different to confirm it as a different node
node.name: esnode1
  1. Configure the IP address of this node. If you use K8S, use a dynamic address. For details, see historical articles
    https://blog.csdn.net/wenyichuan/article/details/108407071
 network.host: esnode1.iscas.svc.cluster.local
  1. Configure the IP of all nodes in the cluster
discovery.zen.ping.unicast.hosts: ["esnode1.iscas.svc.cluster.local", "esnode2.iscas.svc.cluster.local", "esnode3.iscas.svc.cluster.local"]

Write Dockerfile

FROM centos:7

ADD jdk-8u261-linux-x64.tar.gz /usr/local
ADD elasticsearch-6.1.3.tar.gz /home/

RUN mv /usr/local/jdk1.8.0_261 /usr/local/jdk
RUN yum install -y nfs-utils

ENV JAVA_HOME=/usr/local/jdk
ENV JRE_HOME=$JAVA_HOME/jre
ENV CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
ENV PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

RUN groupadd -r es && useradd -r -g es es

RUN chmod -R 777 /home/elasticsearch-6.1.3/
USER es
WORKDIR /home/elasticsearch-6.1.3/bin
ENTRYPOINT [ "./elasticsearch" ]

EXPOSE 9200
EXPOSE 9300

Packaged image

docker build -t esnode .

Guess you like

Origin blog.csdn.net/wenyichuan/article/details/110531668