Docker installation and deployment ElasticSearch (ES)

Preparation before installation

Create mounting directory

Used to mount logs, data, etc. on the host.
Create the /opt/es/data directory
. Create the /opt/es/logs directory.
Create the /opt/es/plugins directory
. Create the /opt/es/conf directory.

mkdir -p /opt/es/{data,logs,plugins,conf}

Authorization related permissions

chmod -R 777 /opt/es/data
chmod -R 777 /opt/es/logs
chmod -R 777 /opt/es/conf
chmod -R 777 /opt/es/plugins

Create elasticsearch.yml file

vim /opt/es/conf/elasticsearch.yml

content
Insert image description here

http.host: 0.0.0.0

Pull image

 docker pull elasticsearch:7.17.2

Insert image description here

Run container

docker run --name elasticsearch -p 9200:9200  -p 9300:9300 \ 
-e "discovery.type=single-node" \ 
-e ES_JAVA_OPTS="-Xms84m -Xmx512m"  \ 
-v /opt/es/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ 
-v /opt/es/data:/usr/share/elasticsearch/data \
-v /opt/es/plugins:/usr/share/elasticsearch/plugins \ 
-d elasticsearch:7.17.2

Insert image description here

Check operation status

Insert image description here
Run successfully

test

URL: IP:9200
and the following screen will appear.
Insert image description here

Guess you like

Origin blog.csdn.net/m0_68681879/article/details/132662290