In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains how to deploy the ElasticSearch:6.8.4 version using Docker, and explains a gadget that pulls from Docker to finally run ElasticSearch and installs ElasticSearch-Head to manage ElasticSearch-related information. ElasticSearch is used to search the front page of this blog system. Because ElasticSearch updates so fast that SpringData-ElasticSearch can't keep up with Es updates, I also started downloading the 8.x version and caused SpringData-ElasticSearch to report an error. In the end, I chose 6.8.4 to record it here.
1.Docker deploys ElasticSearch:6.8.4 version
1.1 pull the image
Docker pull docker.elastic.co/elasticsearch/elasticsearch:6.8.4
1.2 run the container
The default port of ElasticSearch is 9200. By mapping port 9200 of the hosting environment to port 9200 in the Docker container, we can access the ElasticSearch service in the Docker container, and we name the container es.
Docker run-d-name es-p 9200 ES_JAVA_OPTS= 9200-p 9300 ES_JAVA_OPTS= 9300-e "discovery.type=single-node"-Xms=256m-Xms=256m "docker.elastic.co/elasticsearch/elasticsearch:6.8.4
Description:
-e discovery.type=single-node: indicates that a single node is started
-e ES_JAVA_OPTS= "- Xms=256m-Xms=256m": means to set the amount of memory started by es, which really needs to be set, otherwise there will be insufficient memory, such as my own spicy chicken server!
1.3 insufficient memory issu
After centos downloads elasticsearch and modifies the configuration, run the docker command:
It is found that the startup is not successful. The print error is as follows after removing the-d of the command.
Java HotSpot (TM) 64-Bit Server VM warning: INFO:os::commit_memory (0x0000000085330000, 2060255232, 0) failed;error='Cannot allocate memory' (errno=12)
After some search, it is found that this is due to the fact that the default jvm space allocated by elasticsearch7.0 is 2g, and there is not enough memory to allocate it.
The solution is to modify the jvm space allocation
Run the command:
Find / var/lib/docker/overlay/-name jvm.options look for the jvm.options file. After finding it, enter and use the vi command to open jvm.options as follows: modify-Xms2g-Xmx2g to-Xms512m-Xmx512m
Just save and exit. Run the create run elasticsearch command again and start it successfully.
2.Docker deployment ElasticSearch-Heard
2.1 pull the image
Docker pull mobz/elasticsearch-head:5
2.2 run the container
Docker create-- name elasticsearch-head-p 9100 mobz/elasticsearch-head:5
2.3 start the container
Docker start elasticsearch-head
2.4 Open the browser: http://IP:9100
It is found that the connection is not available because there is a cross-domain problem, because the front and rear ends are developed separately, so you need to set up es.
2.5 enter the newly launched es container, container name = es
Docker exec-it es / bin/bash
2.6Modification of elasticsearch.yml files
Vi config/elasticsearch.yml
Add
Http.cors.enabled: truehttp.cors.allow-origin: "*"
In fact, it is the yml file of SpringBoot to add cross-domain support.
2.7 exit the container and restart
Exitdocker restart es
2.8 access to http://localhost:9100
Summary:
This article simply explains how to install ElasticSearch with Docker and the pitfalls you will encounter, including insufficient memory or too high version, as well as the installation and cross-domain configuration of ElasticSearch-Heard. The next article will explain how to install the Chinese word splitter in ElasticSearch.
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
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.