In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to deploy ElasticSearch+ElasticSearch-Head in Docker, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
I. Docker deployment ElasticSearch
1. Pull es image:
[root@TrueDei ~] # docker pull elasticsearch:7.10.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 truedei-es.
[root@TrueDei ~] #
[root@TrueDei ~] # docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
Elasticsearch 7.10.1 558380375f1a 3 weeks ago 774MB
Hello-world latest bf756fb1ae65 12 months ago 13.3kB
Centos/mysql-57-centos7 latest f83a2938370c 14 months ago 452MB
[root@TrueDei ~] #
[root@TrueDei] # docker run-d-- name truedei-es-p 9200 name truedei-es 9200-p 9300 name truedei-es 9300-e "discovery.type=single-node" elasticsearch:7.10.1
Ad6e6d2914272a131ce904e8d1ed9c5580e077c68464cd6cd8bbc00c353098e0
[root@TrueDei ~] #
[root@TrueDei ~] #
3. Enter es:
Because you need to configure es, you need to enter the container.
[root@TrueDei ~] #
[root@TrueDei ~] # docker exec-it truedei-es / bin/bash
[root@ad6e6d291427 elasticsearch] #
4. Configure
Join a cross-domain configuration
[root@TrueDei ~] #
[root@TrueDei ~] # docker exec-it truedei-es / bin/bash
[root@ad6e6d291427 elasticsearch] #
[root@ad6e6d291427 elasticsearch] #
[root@ad6e6d291427 elasticsearch] # ls
LICENSE.txt NOTICE.txt README.asciidoc bin config data jdk lib logs modules plugins
[root@ad6e6d291427 elasticsearch] #
[root@ad6e6d291427 elasticsearch] #
[root@ad6e6d291427 elasticsearch] # cd config/
[root@ad6e6d291427 config] #
[root@ad6e6d291427 config] # ls
Elasticsearch.keystore elasticsearch.yml jvm.options jvm.options.d log4j2.properties role_mapping.yml roles.yml users users_roles
[root@ad6e6d291427 config] #
[root@ad6e6d291427 config] #
[root@ad6e6d291427 config] # vi elasticsearch.yml
[root@ad6e6d291427 config] #
[root@ad6e6d291427 config] # cat elasticsearch.yml
Cluster.name: "docker-cluster"
Network.host: 0.0.0.0
Http.cors.enabled: true
Http.cors.allow-origin: "*"
[root@ad6e6d291427 config] #
5. Exit and restart es
[root@ad6e6d291427 config] #
[root@ad6e6d291427 config] # exit
Exit
[root@TrueDei ~] #
[root@TrueDei ~] # docker restart truedei-es
Truedei-es
[root@TrueDei ~] #
[root@TrueDei ~] #
6. Check whether the startup is successful.
[root@TrueDei] # docker ps-a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
Ad6e6d291427 elasticsearch:7.10.1 "/ tini-- / usr/local..." 4 minutes ago Up 27 seconds 0.0.0.09200/tcp 9200-> 9200/tcp, 9300/tcp truedei-es
7. Whether the test is successful
Browser input: http://IP:9200
II. Docker deployment of ElasticSearch-Head
Why install ElasticSearch-Head because you need an administrative interface to view ElasticSearch-related information
1. Pull the image
[root@TrueDei ~] # docker pull mobz/elasticsearch-head:5
2. Run the container
[root@TrueDei ~] #
[root@TrueDei] # docker run-d-- name truedei-es-head-p 9100 mobz/elasticsearch-head:5
2433913241a2504981088d8ec6c1cc10f7457c1d3abfdb99255e8b2111c81922
[root@TrueDei ~] #
3. Testing
Browser access: http://IP:9100
Then enter the address of your ES service to link
A problem was found when creating the index
Solutions and steps:
Go to ElasticSearch-Head to modify the configuration file
1. Enter the ElasticSearch-Head container:
[root@TrueDei ~] #
[root@TrueDei ~] #
[root@TrueDei ~] # docker exec-it truedei-es-head / bin/bash
Root@2433913241a2:/usr/src/app#
Root@2433913241a2:/usr/src/app#
Root@2433913241a2:/usr/src/app#
Root@2433913241a2:/usr/src/app# cd
Root@2433913241a2:~#
Root@2433913241a2:~#
Root@2433913241a2:~# cd / usr/src/app/
Root@2433913241a2:/usr/src/app# ll
Bash: ll: command not found
Root@2433913241a2:/usr/src/app# ls
Dockerfile LICENCE _ site elasticsearch-head.sublime-workspace index.html package.json src
Gruntfile.js README.textile elasticsearch-head.sublime-project grunt_fileSets.js node_modules plugin-descriptor.properties test
Root@2433913241a2:/usr/src/app#
Root@2433913241a2:/usr/src/app#
Root@2433913241a2:/usr/src/app# cd _ site/
Root@2433913241a2:/usr/src/app/_site#
Root@2433913241a2:/usr/src/app/_site# vi vendor.js
Bash: vi: command not found
Root@2433913241a2:/usr/src/app/_site#
If you say that the vi editor does not exist when editing vendor.js, you need to install vim:
Apt-get update
Apt-get install vim
1. Enter the head installation directory
2 、 cd _ site/
3. There are two places for editing vendor.js.
6886 line / contentType: "application/x-www-form-urlencoded
Change to
ContentType: "application/json;charset=UTF-8"
Line 7574 var inspectData = s.contentType = = "application/x-www-form-urlencoded" & &
Change to
Var inspectData = s.contentType = = "application/json;charset=UTF-8" &
And then restart it.
At this time, the index is also created by OK.
The query is also ok:
Thank you for reading this article carefully. I hope the article "how to deploy ElasticSearch+ElasticSearch-Head in Docker" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
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.