Max_map_count (ES)

View the max_map_count value default is 65530
cat /proc/sys/vm/max_map_count
Copy the code
Reset the value of max_map_count
sysctl -w vm.max_map_count=262144
Copy the code

View the available version of ElasticSearch

docker search elasticsearch
Copy the code

Select elasticSearch version 7.7.0

Docker pull elasticsearch: 7.7.0Copy the code

4. Run the container

docker run --name elasticsearch -d -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" -p 9200:9200 -p Elasticsearch, 9300-9300:7.7.0Copy the code

Five, browser accesshttp://IP:9200To check whether the installation is successful

See elasticSearch-Head version available

docker search elasticsearch
Copy the code

Select elasticSearch -head from version 5

docker pull mobz/elasticsearch-head:5
Copy the code

Eight, run the container

docker run --name elasticsearch-head -p 9100:9100 mobz/elasticsearch-head:5
Copy the code

9. Browser accesshttp://IP:9100To check whether the installation is successful

Modify Elasticsearch. Yml file for Elasticsearch

Into the container
docker exec -it elasticsearch /bin/bash
Copy the code
Edit the elasticsearch. Yml
vi config/elasticsearch.yml
Copy the code
add
http.cors.enabled: true  http.cors.allow-origin: "*"
Copy the code
exit
exit
Copy the code
Check the container

docker ps

restart
Docker restart < container ID>Copy the code

Error code 406 is displayed when you do not modify the configuration of elasticSearch-head

Check the container
docker ps
Copy the code
Copy vendor.js externally
Docker cp < container ID>:/usr/src/app/_site/vendor.js /homeCopy the code
Edit the file
vi vendor.js
Copy the code
Modifying file Contents
ContentType: "Application /x-www-form-urlencoded"; contentType: "application/json; charset=UTF-8",var inspectData = s.contentType === "application/x-www-form-urlencoded" && ( typeof s.data === "string" ); Var inspectData = s.tentType === "application/json; charset=UTF-8" && ( typeof s.data === "string" );Copy the code
The changes are done before copying back to the container
Docker cp /home/vendor.js < container ID>:/usr/src/app/_siteCopy the code
Restart the container
Docker restart < container ID>Copy the code