In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article, Xiaobian introduces in detail how to solve the problem of insufficient memory when docker starts elasticsearch. The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to solve the problem of insufficient memory when docker starts elasticsearch" can help you solve your doubts.
problem
Docker runs out of memory when installing and starting elasticsearch
System centos8 (Ali Cloud ecs server)
[root@iz2zeczvvb79boy368xppwz ~] # cat / etc/redhat-releasecentos linux release 8.1.1911 (core)
Installation process
Docker pull elasticsearch:6.4.0
Modify virtual machine memory (seems to have no effect)
Sysctl-w vm.max_map_count=262144
Use the docker run command to run the container
Docker run-p 9200 cluster.name=elasticsearch 9200-p 9300 discovery.type=single-node 9300-- name elasticsearch\-e "discovery.type=single-node"\-e "cluster.name=elasticsearch"\-v / mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins\-v / mydata/elasticsearch/data:/usr/share/elasticsearch/data\-d elasticsearch:6.4.0
Docker ps checked that the container did not start.
[root@iz2zeczvvb79boy368xppwz ~] # docker pscontainer id image command created status ports namesedfc400862eb rabbitmq:3.7.15 "docker-entrypoint.s …" 14 hours ago up 14 hours 0.0.0.0 4369/tcp 4369-> 4369/tcp, 0.0.0.0 4369/tcp 5671-5672-> 5671-5672/tcp, 0.0.0.0 4369/tcp 15671-15672-> 15671-15672/tcp, 0.0.0.0 4369/tcp 25672-> 25672/tcp rabbitmq2ae2f3f8dc1f nginx:1.10 "nginx-g 'daemon of..." 2 weeks ago up 2 weeks 0.0.0.0 docker-entrypoint.s 80-> 80/tcp, 443/tcp nginx164e4e7561df redis:3.2 "docker-entrypoint.s …" 2 weeks ago up 2 weeks 0.0.0.0 6379/tcp rediseeabe57f1f21 mysql:5.7 6379-> 6379/tcp rediseeabe57f1f21 mysql:5.7 "docker-entrypoint.s …" 2 weeks ago up 2 weeks 0.0.0.0 3306/tcp 3306-> 33060/tcp mysql
Docker ps-a check that the container has indeed been created
[root@iz2zeczvvb79boy368xppwz] # docker ps-acontainer id image command created status ports names767829ae1d7c elasticsearch:6.4.0 "/ usr/local/bin/dock..." About a minute ago exited (1) about a minute ago elasticsearchedfc400862eb rabbitmq:3.7.15 "docker-entrypoint.s …" 14 hours ago up 14 hours 0.0.0.0 4369/tcp 4369-> 4369/tcp, 0.0.0.0 4369/tcp 5671-5672-> 5671-5672/tcp, 0.0.0.0 4369/tcp 15671-15672-> 15671-15672/tcp, 0.0.0.0 4369/tcp 25672-> 25672/tcp rabbitmq2ae2f3f8dc1f nginx:1.10 "nginx-g 'daemon of..." 2 weeks ago up 2 weeks 0.0.0.0 docker-entrypoint.s 80-> 80/tcp, 443/tcp nginx164e4e7561df redis:3.2 "docker-entrypoint.s …" 2 weeks ago up 2 weeks 0.0.0.0 6379/tcp rediseeabe57f1f21 mysql:5.7 6379-> 6379/tcp rediseeabe57f1f21 mysql:5.7 "docker-entrypoint.s …" 2 weeks ago up 2 weeks 0.0.0.0 3306/tcp 3306-> 33060/tcp mysql
View log docker logs-f elasticsearch command View log found that jvm is out of memory
[root@iz2zeczvvb79boy368xppwz] # docker logs-f elasticsearchopenjdk 64-bit server vm warning: option useconcmarksweepgc was deprecated in version 9.0 and will likely be removed in a future release.openjdk 64-bit server vm warning: info: os::commit_memory (0x00007ebf15330000, 549668585472,0) failed; error='not enough space' (errno=12) # # there is insufficient memory for the java runtime environment to continue.# native memory allocation (mmap) failed to map 549668585472 bytes for committing reserved memory.# an error report file with more information is saved as:# logs/hs_err_pid1.log
Solution method
Modify jvm.options file configuration
First look for the jvm.options file location (the location of each server may be different)
[root@iz2zeczvvb79boy368xppwz ~] # find /-name jvm.options/var/lib/docker/overlay2/d399872a3517b4d4acb0d2f70d0625c0f38251ffe5819a1cea00f8213de3e7f5/diff/usr/share/elasticsearch/config/jvm.options
Vim enters the file to modify the minimum memory of the virtual machine
[root@iz2zeczvvb79boy368xppwz ~] # vim / var/lib/docker/overlay2/d399872a3517b4d4acb0d2f70d0625c0f38251ffe5819a1cea00f8213de3e7f5/diff/usr/share/elasticsearch/config/jvm.options
Find the-xms attribute and modify it to 512m (my elasticsearch: 6.4.0 defaults to 1g)
# # jvm configuration# important: jvm heap size# # you should always set the min and max jvm heap## size to the same value. For example, to set## the heap to 4 gb Set:####-xms4g##-xmx4g#### see https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html## for more information# xms represents the initial Size of total heap space# xmx represents the maximum size of total heap space-xms512m-xmx512m
Save and exit
Press I in vim to enter edit mode, press esc to exit edit mode, press: to enter command mode, and then enter w at the bottom command line to save, Q to exit, Q! To force an exit.
Start the container again. Docker ps checks that the container starts successfully.
[root@iz2zeczvvb79boy368xppwz ~] # docker pscontainer id image command created status ports namesf5c4ed61196b elasticsearch:6.4.0 "/ usr/local/bin/dock..." 15 minutes ago up 15 minutes 0.0.0.0 9200/tcp 9200-> 9200/tcp, 0.0.0.0 9200/tcp 9300-> 9300/tcp elasticsearchedfc400862eb rabbitmq:3.7.15 "docker-entrypoint.s …" 15 hours ago up 15 hours 0.0.0.0 hours 4369-> 4369/tcp, 0.0.0.0 4369/tcp 5671-5672-> 5671-5672/tcp, 0.0.0.0 4369/tcp 15671-15672-> 15671-15672/tcp, 0.0.0.0 4369/tcp 25672-> 25672/tcp rabbitmq2ae2f3f8dc1f nginx:1.10 "nginx-g 'daemon of..." 2 weeks ago up 2 weeks 0.0.0.0 docker-entrypoint.s 80-> 80/tcp, 443/tcp nginx164e4e7561df redis:3.2 "docker-entrypoint.s …" 2 weeks ago up 2 weeks 0.0.0.0 6379/tcp rediseeabe57f1f21 mysql:5.7 6379-> 6379/tcp rediseeabe57f1f21 mysql:5.7 "docker-entrypoint.s …" 2 weeks ago up 2 weeks 0.0.0.0 3306/tcp 3306-> 3306/tcp, 33060/tcp mysql reads here, this article "how to solve the problem of insufficient memory when docker starts elasticsearch" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, please follow 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.