本文小編為大家詳細介紹“docker啟動elasticsearch時內(nèi)存不足怎么解決”,內(nèi)容詳細,步驟清晰,細節(jié)處理妥當(dāng),希望這篇“docker啟動elasticsearch時內(nèi)存不足怎么解決”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學(xué)習(xí)新知識吧。
成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站制作、做網(wǎng)站與策劃設(shè)計,西夏網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)10年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:西夏等地區(qū)。西夏做網(wǎng)站價格咨詢:028-86922220問題
docker安裝并啟動elasticsearch時內(nèi)存不足
系統(tǒng)centos8(阿里云ecs服務(wù)器)
[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文件位置(每個服務(wù)器的位置可能不同)
[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默認(rèn)為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 /tupian/20230522/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)存不足怎么解決”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領(lǐng)會,如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。
名稱欄目:docker啟動elasticsearch時內(nèi)存不足怎么解決-創(chuàng)新互聯(lián)
文章地址:http://jinyejixie.com/article30/jgcso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、虛擬主機、網(wǎng)站導(dǎo)航、網(wǎng)站制作、品牌網(wǎng)站制作、手機網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容