亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁/技術(shù)文章
文章詳情頁

docker啟動ES內(nèi)存溢出的解決方案

瀏覽:62日期:2024-10-30 11:41:54

在elasticsearch的config中加jvm.options文件,修改堆棧大小,默認是2GB,直接啟動es即可,保證之前已經(jīng)映射了配置文件。

-Xms5g-Xmx5g完整jvm.options文件如下:

## 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-Xms5g-Xmx5g################################################################## Expert settings#################################################################### All settings below this section are considered## expert settings. Don’t tamper with them unless## you understand what you are doing#################################################################### GC configuration-XX:+UseConcMarkSweepGC-XX:CMSInitiatingOccupancyFraction=75-XX:+UseCMSInitiatingOccupancyOnly## optimizations# pre-touch memory pages used by the JVM during initialization-XX:+AlwaysPreTouch## basic# force the server VM (remove on 32-bit client JVMs)-server# explicitly set the stack size (reduce to 320k on 32-bit client JVMs)-Xss1m# set to headless, just in case-Djava.awt.headless=true# ensure UTF-8 encoding by default (e.g. filenames)-Dfile.encoding=UTF-8# use our provided JNA always versus the system one-Djna.nosys=true# use old-style file permissions on JDK9-Djdk.io.permissionsUseCanonicalPath=true# flags to configure Netty-Dio.netty.noUnsafe=true-Dio.netty.noKeySetOptimization=true-Dio.netty.recycler.maxCapacityPerThread=0# log4j 2-Dlog4j.shutdownHookEnabled=false-Dlog4j2.disable.jmx=true-Dlog4j.skipJansi=true## heap dumps# generate a heap dump when an allocation from the Java heap fails# heap dumps are created in the working directory of the JVM-XX:+HeapDumpOnOutOfMemoryError# specify an alternative path for heap dumps# ensure the directory exists and has sufficient space#-XX:HeapDumpPath=${heap.dump.path}## GC logging#-XX:+PrintGCDetails#-XX:+PrintGCTimeStamps#-XX:+PrintGCDateStamps#-XX:+PrintClassHistogram#-XX:+PrintTenuringDistribution#-XX:+PrintGCApplicationStoppedTime# log GC status to a file with time stamps# ensure the directory exists#-Xloggc:${loggc}# By default, the GC log file will not rotate.# By uncommenting the lines below, the GC log file# will be rotated every 128MB at most 32 times.#-XX:+UseGCLogFileRotation#-XX:NumberOfGCLogFiles=32#-XX:GCLogFileSize=128M# Elasticsearch 5.0.0 will throw an exception on unquoted field names in JSON.# If documents were already indexed with unquoted fields in a previous version# of Elasticsearch, some operations may throw errors.## WARNING: This option will be removed in Elasticsearch 6.0.0 and is provided# only for migration purposes.#-Delasticsearch.json.allow_unquoted_field_names=true

補充:Docker 容器內(nèi)存限制

Docker 內(nèi)存限制

docker run -d -i -t -m 256M --memory-swap 512M --name centos2.12 centos /bin/bash查看容器實例 內(nèi)存限制:

docker啟動ES內(nèi)存溢出的解決方案

限制容器內(nèi)存大小;

docker run -d -i -t -m 256M --memory-swap 512M --name centos centos /bin/bash

-m, --memory # 內(nèi)存限制大小,單位可以為 b,k,M,g;最小為4M--memory-swap# 內(nèi)存+交換分區(qū)大小總限制--memory-reservation # 預留內(nèi)存大小;容器在宿主機最小占用內(nèi)存;--oom-kill-disable# out-of-memory 內(nèi)存溢出;限制kill容器進程,默認沒設(shè)置--oom-score-adj# 容器被 OOM killer 殺死的優(yōu)先級,范圍是[-1000, 1000],默認為 0--memory-swappiness# 用于設(shè)置容器的虛擬內(nèi)存控制行為。值為 0~100 之間的整數(shù)--kernel-memory核心內(nèi)存限制,最小為 4M。1、memory 設(shè)置容器內(nèi)存大小;

--memory-swap 不是交換分區(qū),而是 memory + swap 的大小;容器的交換分區(qū) swap = memory-swap - memory2、Docker 默認容器交換分區(qū)的大小和內(nèi)存相同

memory-swap 不設(shè)置 或者設(shè)置為 0 ;容器的交換分區(qū) swap 大小就是 memory 的小大;容器的進程使用最大內(nèi)存 = memory + swap3、memory-swap 設(shè)置

當 memory-swap 設(shè)置為 -1 時;容器內(nèi)存大小為 memory 設(shè)置的大小;交換分區(qū)大小為宿主機 swap 大小;容器進程能使用的最大內(nèi)存 = memory + 宿主機 swap 大小;4、內(nèi)存溢出

--oom-kill-disable限制 kill 容器進程; (必須設(shè)置在 memory 之后才有限;)docker run -d -i -t -m 256M --oom-kill-disable --name Centos-1 centos /bin/bash5、核心內(nèi)存 & 用戶內(nèi)存

核心內(nèi)存和用戶內(nèi)存不同的地方在于核心內(nèi)存不能被交換出。

不能交換出去的特性使得容器可以通過消耗太多內(nèi)存來堵塞一些系統(tǒng)服務(wù)。

核心內(nèi)存包括:stack pages(棧頁面)slab pagessocket memory pressuretcp memory pressure

可以通過設(shè)置核心內(nèi)存限制來約束這些內(nèi)存。

每個進程都要消耗一些棧頁面,通過限制核心內(nèi)存,可以在核心內(nèi)存使用過多時阻止新進程被創(chuàng)建。

docker run -d -i -t -m 500M --kernel-memory 128M --name Centos-2 centos /bin/bash限制容器內(nèi)存 256M;限制核心內(nèi)存 128M 。docker run -d -i -t --kernel-memory 128M --name Centos-3 centos /bin/bash內(nèi)存為宿主機memory大小, 限制核心內(nèi)存 128M6、Swappiness 內(nèi)存回收頁

容器的內(nèi)核可以交換出一定比例的匿名頁。

--memory-swappiness就是用來設(shè)置這個比例的。--memory-swappiness可以設(shè)置為從 0 到 100。# 0 表示關(guān)閉匿名頁面交換。# 100 表示所有的匿名頁都可以交換。默認情況下,如果不適用--memory-swappiness,則該值從父進程繼承而來。docker run -d -i -t --memory-swappiness=0 --name Centos-4 centos /bin/bash將--memory-swappiness設(shè)置為 0 可以保持容器的工作集,避免交換代理的性能損失。

Swappiness 的值越大,表示越積極使用swap分區(qū),越小表示越積極使用物理內(nèi)存。默認值swappiness=60

sysctl vm.swappiness = 100 # cat /proc/sys/vm/swappiness

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持好吧啦網(wǎng)。如有錯誤或未考慮完全的地方,望不吝賜教。

標簽: Docker
相關(guān)文章:
主站蜘蛛池模板: 国产精品va在线观看手机版 | 国产丝袜啪啪 | 中国日本欧美韩国18 | 日韩a级毛片免费观看 | 日韩女性性生生活视频 | 国内视频一区二区三区 | 免费看欧美一级特黄α大片 | 日韩在线视精品在亚洲 | 色综合久久亚洲国产日韩 | 国产麻豆精品视频 | 亚洲不卡影院 | 国内永久第一免费福利视频 | 狠狠色成人综合网图片区 | 香蕉爱视频 | 在线观看国产一区 | 免费网站在线观看高清版 | 亚洲午夜一区二区三区 | 亚洲天堂高清 | a一级日本特黄aaa大片 | 日韩视频高清免费看 | 久久精视频 | 91亚洲精品一区二区福利 | 亚洲国产精品免费在线观看 | 日产一区日产2区 | 一级全黄男女免费大片 | 国产福利写真视频在线观看 | 欧美视频在线免费播放 | 超级碰碰碰免费视频播放 | 国产小视频网站 | 久久99精品久久久久久欧洲站 | 中国一级毛片欧美一级毛片 | 日本一级成人毛片免费观看 | 欧美成人精品手机在线观看 | 日韩视频在线观看免费 | 91视频一区二区 | 一级黄色欧美片 | 免费黄色视屏网站 | 女人被男人狂躁免费视频 | 美国一级片在线 | 成人一级毛片 | 日本一级特黄刺激爽大片 |