How to deploy ElasticSearch in Docker

How to deploy ElasticSearch in Docker

1. What is ElasticSearch?

Elasticsearch is also developed in Java and uses Lucene as its core to implement all indexing and search functions, but its purpose is to hide the complexity of Lucene through a simple RESTful API, making full-text search simple.

However, Elasticsearch is more than just Lucene and full-text search. We can also describe it like this:

Distributed real-time file storage, each field is indexed

A distributed real-time analytical search engine that can be searched and indexed

Can be expanded to hundreds of servers and process PB-level structured or unstructured data

2. Deploy ElasticSearch with Docker

2.1 Pull the image

docker pull docker.elastic.co/elasticsearch/elasticsearch:6.3.2

2.2 Run the container

The default port of ElasticSearch is 9200. We map the host environment port 9200 to the Docker container port 9200, and then we can access the ElasticSearch service in the Docker container. At the same time, we name this container es .

Copy the code as follows:
docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.3.2

2.3 Configuring cross-domain

2.3.1 Entering the container

Since configuration is required, you need to enter the container to modify the corresponding configuration information.

docker exec -it es /bin/bash

2.3.2 Configuration

# Display file ls
The results are as follows:
LICENSE.txt README.textile config lib modules
NOTICE.txt bin data logs plugins

# Enter the configuration folder cd config

# Display file ls
The results are as follows:
elasticsearch.keystore ingest-geoip log4j2.properties roles.yml users_roles
elasticsearch.yml jvm.options role_mapping.yml users

# Modify the configuration file vi elasticsearch.yml

# Add cross-domain configuration http.cors.enabled: true
http.cors.allow-origin: "*"

2.3 Restarting the container

Since the configuration has been modified, the ElasticSearch container needs to be restarted.

docker restart es

The display is as follows:

3. Docker deployment of ElasticSearch-Head

Why install ElasticSearch-Head ? The reason is that you need a management interface to view ElasticSearch related information

3.1 Pull the image

docker pull mobz/elasticsearch-head:5

3.2 Run the container

docker run -d --name es_admin -p 9100:9100 mobz/elasticsearch-head:5

The display is as follows:




In this way, we have completed the use of Docker to provide Elasticsearch services without polluting the host environment. This has another benefit. If you want to start multiple different versions of Elastcsearch or other services at the same time, Docker is also an ideal solution.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Tutorial on installing Elasticsearch 7.6.2 in Docker
  • Insufficient memory problem and solution when docker starts elasticsearch
  • How to install elasticsearch and kibana in docker
  • Docker installs Elasticsearch7.6 cluster and sets password
  • Sample code for installing ElasticSearch and Kibana under Docker
  • Detailed explanation of using Elasticsearch visualization Kibana under Docker
  • How to install ElasticSearch on Docker in one article

<<:  MySQL implements a function similar to connect_by_isleaf MySQL method or stored procedure

>>:  Do you know the weird things in Javascript?

Recommend

Solution to data duplication when using limit+order by in MySql paging

Table of contents summary Problem Description Ana...

Implementation of HTML sliding floating ball menu effect

CSS Styles html,body{ width: 100%; height: 100%; ...

Detailed tutorial on installing mysql-8.0.20 under Linux

** Install mysql-8.0.20 under Linux ** Environmen...

The meaning and calculation method of QPS and TPS of MySQL database

When doing DB benchmark testing, qps and tps are ...

CSS3 achieves various border effects

Translucent border Result: Implementation code: &...

Solve the problem of using less in Vue

1. Install less dependency: npm install less less...

Optimize MySQL with 3 simple tweaks

I don't expect to be an expert DBA, but when ...

Determine the direction of mouse entry based on CSS

In a front-end technology group before, a group m...

How to run the react project on WeChat official account

Table of contents 1. Use the a tag to preview or ...

How to implement form validation in Vue

1. Installation and use First, install it in your...

What you need to know about creating MySQL indexes

Table of contents Preface: 1. Create index method...

Linux common commands chmod to modify file permissions 777 and 754

The following command is often used: chmod 777 文件...

Personal opinion: Talk about design

<br />Choose the most practical one to talk ...

MySQL sorting feature details

Table of contents 1. Problem scenario 2. Cause An...

Detailed installation process of MySQL 8.0 Windows zip package version

The installation process of MySQL 8.0 Windows zip...