This is the 10th day of my participation in the August More text Challenge. For details, see: August More Text Challenge

As anyone who has installed ElasticSearch the traditional way knows, there are a lot of holes to fill. So I’m going to record how I installed ElasticSearch on my PC and help you close it.

Note: The plugin version for Kibana, ES and ES should be the same

1. Pull the mirror

Docker pull elasticsearch: 7.10.1Copy the code

2. Create a folder

As described above, you need to mount configuration files and data files on the host.

mkdir -p /usr/local/elasticsearch/config
mkdir -p /usr/local/elasticsearch/data
Copy the code

3. Modify the configuration file

A lot of personalization needs to be modified in a mid-price installation. Here go into the folder I created above. New elasticSearch. yml file.

cd /usr/local/elasticsearch/config/
vi elasticsearch.yml
Copy the code

Yml The configuration for ElasticSearch. yml is as follows

Host: 0.0.0.0 network.bind_host: 0.0.0.0 # Http.ors. Enabled: true http.ors. "*" xpack. Security. Enabled: true # said to open the configuration xpack authentication mechanism spring boot connections using xpack. Security. Transport.. SSL enabled: trueCopy the code

After xpack. Security is configured, elasticSearch requires an account and password. If you use SpringBoot queries, make sure you set them, otherwise you will report an error!

4. Start

docker run -p 9200:9200 --name elasticsearch \ -e "discovery.type=single-node" \ -e ES_JAVA_OPTS="-Xms1g -Xmx2g" \ -v /usr/local/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /usr/local/elasticsearch/data:/usr/share/elasticsearch/data \ -v / usr/local/elasticsearch/plugins: / usr/share/elasticsearch/plugins \ - d elasticsearch: 7.10.1Copy the code

Parameter description:

  • -p 9200:9200: specifies the port number
  • –name Elasticsearch \ : Specifies the container name
  • -e “discovery.type=single-node” \ : Single-machine mode
  • -e ES_JAVA_OPTS=” -xms1g -XMx2g “\ : Specify memory
  • – v/usr/local/elasticsearch/config/elasticsearch yml: / usr/share/elasticsearch/config/elasticsearch. Yml \ : specify the config in the host machine
  • – v/usr/local/elasticsearch/data: / usr/share/elasticsearch/data \ : specify the data on the host machine
  • – v/usr/local/elasticsearch/plugins: / usr/share/elasticsearch/plugins \ : specifying the position in the host machine
  • -d ElasticSearch :7.10.1: Specifies the image

5. Initialize the password

This is only required with the xPack configuration above, first go to the container command line, and then go straight to initialize the command:

perform

Docker exec -it container ID /bin/bash bin/elasticsearch-setup-passwords InteractiveCopy the code

Then enter the password in turn (many, many times, don’t struggle, enter it!).

6. Verify

Access IP :9200, if xpack.security is enabled above, you need to enter the account password. Account/Password: Elastic/password set above

If the following page appears, it is successful.

7. Install the plug-in

1. Install

Download at github.com/medcl/elast… The main requirement is to select the same version as the ES

Put it in the same configuration plugins path as above, then create a new ik folder, and put all the decompressed files in the IK folder.

Restart the Docker container

docker restart 556b198b7616
Copy the code

2. Verify

After the restart, check whether the word segmentation takes effect.

GET _analyze? Pretty {"analyzer": "ik_max_word", "text": "I eat tomatoes"}Copy the code

If the following results occur, the installation takes effect.