主頁 > 知識庫 > docker 報(bào)錯 Exited (1) 4 minutes ago的原因分析

docker 報(bào)錯 Exited (1) 4 minutes ago的原因分析

熱門標(biāo)簽:百度地圖底圖標(biāo)注 新鄉(xiāng)牧野400電話申請 高德地圖標(biāo)注足跡怎么打標(biāo) 電銷智能機(jī)器人試用 智能電銷機(jī)器人真的有用么 中國地圖標(biāo)注上各個省 撫州市城區(qū)地圖標(biāo)注 激光標(biāo)記地圖標(biāo)注 企業(yè)辦理400電話收費(fèi)標(biāo)準(zhǔn)

docker 報(bào)錯

1. 查看原因

docker logs nexus

2. 報(bào)錯原因

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e7000000, 419430400, 0) failed; error=‘Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 419430400 bytes for committing reserved memory. # An error report file with more information is saved as: # /opt/sonatype/nexus/hs_err_pid1.log

補(bǔ)充知識:Docker 安裝運(yùn)行 ElasticSearch 遇到的問題!

在創(chuàng)建 6.4.3版本的 ES 以后啟動發(fā)現(xiàn)過了一會 ES 自動退出了。

原因好像是 ES 的默認(rèn)分配的內(nèi)存太大了。進(jìn)程被自動殺死了。

所以以下我來記錄下這坑:

使用ES工具類索引時運(yùn)行測試方法時報(bào)錯

org.elasticsearch.transport.ConnectTransportException: [][192.168.235.9300] connect_timeout[30s]

發(fā)現(xiàn)使用SpringBoot 2.x的版本導(dǎo)入的ES的包與Docker 上安裝的 ES 版本不兼容的問題。

SpringBoot 2.1.3版本引入的Spring-Data-ES包為:3.1.5

Docker安裝的ES版本為:5.6.12

查看官方文檔的適配關(guān)系:

發(fā)現(xiàn) 3.1.X 對應(yīng)需要ES 6.2.2版本以上

我項(xiàng)目整合的ES的Jar包為6.4.3

然后我們在Docker 安裝 6.4.3版本的 ES

我們使用 Docker 中國官方鏡像加速:

# docker pull registry.docker-cn.com/library/elasticsearch:6.4.3

下載完畢后我們創(chuàng)建容器并啟動:

//列出本地所有鏡像
 
# docker images
REPOSITORY          TAG     IMAGE ID   CREATED    SIZE
registry.docker-cn.com/library/rabbitmq  3-management  92682ab7dca0  12 days ago   212MB
registry.docker-cn.com/library/elasticsearch 6.4.3    01e5bee1e059  4 months ago  795MB
registry.docker-cn.com/library/elasticsearch latest    5acf0e8da90b  5 months ago  486MB

由于ES版本在 5.0 以后默認(rèn)分配的內(nèi)存是 2G 創(chuàng)建Docker啟動時需要 1G 所以我們可以參數(shù)上設(shè)置它的環(huán)境變量:

也可以更改對應(yīng)的 jvm.options 配置

我們創(chuàng)建運(yùn)行 6.4.3 的ES

# docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9200 -p 9301:9300 --name ES02 01e5bee1e059

然后出現(xiàn)了下列情況以后,ES 容器自動停止了。:

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-03-06T03:29:17,534][INFO ][o.e.n.Node    ] [] initializing ...
[2019-03-06T03:29:17,680][INFO ][o.e.e.NodeEnvironment ] [gV0jbyu] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [13.6gb], net total_space [16.9gb], types [rootfs]
[2019-03-06T03:29:17,681][INFO ][o.e.e.NodeEnvironment ] [gV0jbyu] heap size [247.6mb], compressed ordinary object pointers [true]
[2019-03-06T03:29:17,690][INFO ][o.e.n.Node    ] [gV0jbyu] node name derived from node ID [gV0jbyuBSrmiqJJ8p524XA]; set [node.name] to override
[2019-03-06T03:29:17,691][INFO ][o.e.n.Node    ] [gV0jbyu] version[6.4.3], pid[1], build[default/tar/fe40335/2018-10-30T23:17:19.084789Z], OS[Linux/3.10.0-957.5.1.el7.x86_64/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10.0.2/10.0.2+13]
[2019-03-06T03:29:17,691][INFO ][o.e.n.Node    ] [gV0jbyu] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.GVv4IesY, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Xms256m, -Xmx256m, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-03-06T03:29:22,164][INFO ][o.e.p.PluginsService  ] [gV0jbyu] loaded module [aggs-matrix-stats]
.
.
.
[2019-03-06T03:29:26,129][WARN ][o.e.d.s.ScriptModule  ] Script: returning default values for missing document values is deprecated. Set system property '-Des.scripting.exception_for_missing_value=true' to make behaviour compatible with future major versions.
[2019-03-06T03:29:30,804][INFO ][o.e.x.s.a.s.FileRolesStore] [gV0jbyu] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
[2019-03-06T03:29:31,986][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/62] [Main.cc@109] controller (64 bit): Version 6.4.3 (Build 7a0781676dd492) Copyright (c) 2018 Elasticsearch BV
[2019-03-06T03:29:32,929][INFO ][o.e.d.DiscoveryModule ] [gV0jbyu] using discovery type [zen]
[2019-03-06T03:29:34,282][INFO ][o.e.n.Node    ] [gV0jbyu] initialized
[2019-03-06T03:29:34,283][INFO ][o.e.n.Node    ] [gV0jbyu] starting ...
[2019-03-06T03:29:34,625][INFO ][o.e.t.TransportService ] [gV0jbyu] publish_address {172.17.0.2:9300}, bound_addresses {0.0.0.0:9300}
[2019-03-06T03:29:34,656][INFO ][o.e.b.BootstrapChecks ] [gV0jbyu] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-03-06T03:29:34,721][INFO ][o.e.n.Node    ] [gV0jbyu] stopping ...
[2019-03-06T03:29:34,760][INFO ][o.e.n.Node    ] [gV0jbyu] stopped
[2019-03-06T03:29:34,760][INFO ][o.e.n.Node    ] [gV0jbyu] closing ...
[2019-03-06T03:29:34,778][INFO ][o.e.n.Node    ] [gV0jbyu] closed
[2019-03-06T03:29:34,780][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started

輸出了一下錯誤日志,大致翻譯了一下看到了這句話:

[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

說是 最大虛擬內(nèi)存區(qū) vm.max_map_count 設(shè)置的 65530 太低,至少要增加到 262144

網(wǎng)上百度了一下設(shè)置方法:

# sudo sysctl -w vm.max_map_count=262144

然后我們再來啟動 ES

# docker start ES02

過一會我們再來查看它的狀態(tài):

# docker ps -a
CONTAINER ID  IMAGE    COMMAND     CREATED    STATUS      PORTS           NAMES
bdaed6794ca6  5acf0e8da90b  "/docker-entrypoint.…" 5 minutes ago  Exited (130) 6 seconds ago             ES01
7d2dcc5512ee  01e5bee1e059  "/usr/local/bin/dock…" 3 hours ago   Up 15 minutes    0.0.0.0:9201->9200/tcp, 0.0.0.0:9301->9300/tcp ES02
d372501cc505  92682ab7dca0  "docker-entrypoint.s…" 4 days ago   Exited (0) 22 hours ago              myrabbitmq

發(fā)現(xiàn)是正常啟動的以后我們來訪問一下 http 對應(yīng)的端口:

http://192.168.235.128:9201/

發(fā)現(xiàn)我們安裝的 6.4.3 版本的 ES 就沒有問題了。

以上這篇docker 報(bào)錯 Exited (1) 4 minutes ago的原因分析就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

標(biāo)簽:邯鄲 延安 南通 臨汾 忻州 辛集 海西 西安

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《docker 報(bào)錯 Exited (1) 4 minutes ago的原因分析》,本文關(guān)鍵詞  docker,報(bào)錯,Exited,minutes,ago,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《docker 報(bào)錯 Exited (1) 4 minutes ago的原因分析》相關(guān)的同類信息!
  • 本頁收集關(guān)于docker 報(bào)錯 Exited (1) 4 minutes ago的原因分析的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章