主頁 > 知識庫 > docker啟動elasticsearch時內(nèi)存不足問題及解決方法

docker啟動elasticsearch時內(nèi)存不足問題及解決方法

熱門標簽:宿州防封外呼系統(tǒng)廠家 濟源電話外呼系統(tǒng)怎么樣 山東400電話如何辦理 電話機器人服務差 高德地圖標注在建線路 蘭州語音電銷機器人軟件 智能外呼系統(tǒng)如何部署 ai電銷機器人 如何開發(fā) 電銷機器人對公司貢獻

問題

docker安裝并啟動elasticsearch時內(nèi)存不足

系統(tǒng)centos8(阿里云ecs服務器)

[root@iZ2zeczvvb79boy368xppwZ ~]# cat /etc/redhat-release
CentOS Linux release 8.1.1911 (Core)

安裝過程

docker pull elasticsearch:6.4.0

修改虛擬機內(nèi)存(貌似沒有效果)

sysctl -w vm.max_map_count=262144

使用docker run命令跑容器

docker run -p 9200:9200 -p 9300: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查看容器并沒有啟動

[root@iZ2zeczvvb79boy368xppwZ ~]# docker ps
CONTAINER ID  IMAGE    COMMAND     CREATED    STATUS    PORTS                              NAMES
edfc400862eb  rabbitmq:3.7.15  "docker-entrypoint.s…" 14 hours ago  Up 14 hours   0.0.0.0:4369->4369/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:15671-15672->15671-15672/tcp, 0.0.0.0:25672->25672/tcp rabbitmq
2ae2f3f8dc1f  nginx:1.10   "nginx -g 'daemon of…" 2 weeks ago   Up 2 weeks   0.0.0.0:80->80/tcp, 443/tcp                        nginx
164e4e7561df  redis:3.2   "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:6379->6379/tcp                          redis
eeabe57f1f21  mysql:5.7   "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:3306->3306/tcp, 33060/tcp                       mysql

docker ps -a 查看容器確實創(chuàng)建了

[root@iZ2zeczvvb79boy368xppwZ ~]# docker ps -a
CONTAINER ID  IMAGE     COMMAND     CREATED    STATUS       PORTS                              NAMES
767829ae1d7c  elasticsearch:6.4.0 "/usr/local/bin/dock…" About a minute ago Exited (1) About a minute ago                                elasticsearch
edfc400862eb  rabbitmq:3.7.15  "docker-entrypoint.s…" 14 hours ago   Up 14 hours      0.0.0.0:4369->4369/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:15671-15672->15671-15672/tcp, 0.0.0.0:25672->25672/tcp rabbitmq
2ae2f3f8dc1f  nginx:1.10   "nginx -g 'daemon of…" 2 weeks ago   Up 2 weeks      0.0.0.0:80->80/tcp, 443/tcp                        nginx
164e4e7561df  redis:3.2    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks      0.0.0.0:6379->6379/tcp                          redis
eeabe57f1f21  mysql:5.7    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks      0.0.0.0:3306->3306/tcp, 33060/tcp                       mysql

查看日志docker logs -f elasticsearch命令查看日志發(fā)現(xiàn)jvm內(nèi)存不足

[root@iZ2zeczvvb79boy368xppwZ ~]# docker logs -f elasticsearch
OpenJDK 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

解決方法

修改jvm.options文件配置
首先查找jvm.options文件位置(每個服務器的位置可能不同)

[root@iZ2zeczvvb79boy368xppwZ ~]# find / -name jvm.options
/var/lib/docker/overlay2/d399872a3517b4d4acb0d2f70d0625c0f38251ffe5819a1cea00f8213de3e7f5/diff/usr/share/elasticsearch/config/jvm.options

vim進入文件修改虛擬機最小內(nèi)存

[root@iZ2zeczvvb79boy368xppwZ ~]# vim /var/lib/docker/overlay2/d399872a3517b4d4acb0d2f70d0625c0f38251ffe5819a1cea00f8213de3e7f5/diff/usr/share/elasticsearch/config/jvm.options

找到-Xms屬性,修改成512m(我的elasticsearch:6.4.0默認為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

保存并退出

vim中按i進入編輯模式,按ESC退出編輯模式,按:進入命令模式,然后在底部命令行輸入w為保存,q為退出,q!為強制退出。
再次啟動容器,docker ps查看容器啟動成功

[root@iZ2zeczvvb79boy368xppwZ ~]# docker ps
CONTAINER ID  IMAGE     COMMAND     CREATED    STATUS    PORTS                              NAMES
f5c4ed61196b  elasticsearch:6.4.0 "/usr/local/bin/dock…" 15 minutes ago  Up 15 minutes  0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp                    elasticsearch
edfc400862eb  rabbitmq:3.7.15  "docker-entrypoint.s…" 15 hours ago  Up 15 hours   0.0.0.0:4369->4369/tcp, 0.0.0.0:5671-5672->5671-5672/tcp, 0.0.0.0:15671-15672->15671-15672/tcp, 0.0.0.0:25672->25672/tcp rabbitmq
2ae2f3f8dc1f  nginx:1.10   "nginx -g 'daemon of…" 2 weeks ago   Up 2 weeks   0.0.0.0:80->80/tcp, 443/tcp                        nginx
164e4e7561df  redis:3.2    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:6379->6379/tcp                          redis
eeabe57f1f21  mysql:5.7    "docker-entrypoint.s…" 2 weeks ago   Up 2 weeks   0.0.0.0:3306->3306/tcp, 33060/tcp                       mysql

總結

到此這篇關于docker啟動elasticsearch時內(nèi)存不足問題及解決方法的文章就介紹到這了,更多相關docker啟動elasticsearch內(nèi)存不足內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

標簽:衡水 晉中 南寧 巴中 佛山 畢節(jié) 安陽 云南

巨人網(wǎng)絡通訊聲明:本文標題《docker啟動elasticsearch時內(nèi)存不足問題及解決方法》,本文關鍵詞  docker,啟動,elasticsearch,時,;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《docker啟動elasticsearch時內(nèi)存不足問題及解決方法》相關的同類信息!
  • 本頁收集關于docker啟動elasticsearch時內(nèi)存不足問題及解決方法的相關信息資訊供網(wǎng)民參考!
  • 推薦文章