In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
Today Xiaobian to share with you Docker how to deploy ElasticSearch and ElasticSearch-Head related knowledge points, detailed content, clear logic, I believe most people still know too much about this knowledge, so share this article for your reference, I hope you have something to gain after reading this article, let's learn about it together.
1.docker Deployment elasticsearch: Version 6.8.4
1.1 pull images from the nearest region
docker pull docker.elastic.co/elasticsearch/elasticsearch:6.8.4
1.2 run containers
The default port of elasticsearch is 9200. We can access elasticsearch service in docker container by mapping port 9200 of host environment to port 9200 in docker container, and we will name this container es.
docker run -d --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e es_java_opts="-xms=256m -xms=256m" docker.elastic.co/elasticsearch/elasticsearch:6.8.4
Description:
-e discovery.type=single-node: indicates single-node startup
-e es_java_opts="-xms=256m -xms=256m": means to set the memory size of es startup, this really needs to be set, otherwise there will be insufficient memory later, such as my own spicy chicken server!
1.3 Out of memory problem
After centos downloads elasticsearch and modifies the configuration, run docker:
Found no successful startup, remove the command-d after printing error as follows
java hotspot(tm) 64-bit server vm warning: info:os::commit_memory(0x0000000085330000, 2060255232, 0) failed;error='cannot allocate memory' (errno=12)
After a search found that this is due to elasticsearch6.0 default allocation jvm space size of 2g, memory is not enough to allocate caused.
The solution is to modify the jvm space allocation
Run command:
find /var/lib/docker/overlay/ -name jvm.options Find the jvm.options file and enter the vi command to open jvm.options as follows: modify-xms2g -xmx2g to-xms512m -xmx512m
Save and exit. Run the Create Run elasticsearch command again and it starts successfully.
2.docker deployment elasticsearch-heard
2.1 pull images from the nearest region
docker pull mobz/elasticsearch-head:5
2.2 run containers
docker create --name elasticsearch-head -p 9100:9100 mobz/elasticsearch-head:5
2.3 start the container
docker start elasticsearch-head
2.4 Open browser: http://ip:9100
It was found that the connection did not work because there was a cross-domain problem. Because the front and back ends were developed separately, it was necessary to set es.
2.5 Enter the es container just started, container name = es
docker exec -it es /bin/bash
2.6 Modify elasticsearch.yml file
vi config/elasticsearch.yml
added
http.cors.enabled: truehttp.cors.allow-origin: "*"
In fact, it is the yml file of springboot to add cross-domain support
2.7 Exit container and restart
exitdocker restart es
2.8 access
That's all for Docker How to Deploy ElasticSearch and ElasticSearch-Head. Thanks for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.