亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時(shí)間:2021年03月29日 11:42:42   作者:Airship  
這篇文章主要介紹了docker啟動(dòng)ES內(nèi)存溢出的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

在elasticsearch的config中加jvm.options文件,修改堆棧大小,默認(rèn)是2GB,直接啟動(dòng)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

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

Docker 內(nèi)存限制

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

查看容器實(shí)例 內(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 # 預(yù)留內(nèi)存大??;容器在宿主機(jī)最小占用內(nèi)存;
--oom-kill-disable
# out-of-memory 內(nèi)存溢出;限制kill容器進(jìn)程,默認(rèn)沒(méi)設(shè)置
--oom-score-adj
# 容器被 OOM killer 殺死的優(yōu)先級(jí),范圍是[-1000, 1000],默認(rèn)為 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 - memory

2、Docker 默認(rèn)容器交換分區(qū)的大小和內(nèi)存相同

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

3、memory-swap 設(shè)置

當(dāng) memory-swap 設(shè)置為 -1 時(shí);
容器內(nèi)存大小為 memory 設(shè)置的大??;
交換分區(qū)大小為宿主機(jī) swap 大??;
容器進(jìn)程能使用的最大內(nèi)存 = memory + 宿主機(jī) swap 大?。?

4、內(nèi)存溢出

--oom-kill-disable
限制 kill 容器進(jìn)程; (必須設(shè)置在 memory 之后才有限;)
docker run -d -i -t -m 256M --oom-kill-disable --name Centos-1 centos /bin/bash

5、核心內(nèi)存 & 用戶內(nèi)存

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

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

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

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

每個(gè)進(jìn)程都要消耗一些棧頁(yè)面,通過(guò)限制核心內(nèi)存,可以在核心內(nèi)存使用過(guò)多時(shí)阻止新進(jìn)程被創(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)存為宿主機(jī)memory大小, 限制核心內(nèi)存 128M

6、Swappiness 內(nèi)存回收頁(yè)

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

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

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

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

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教。

相關(guān)文章

  • Docker磁盤(pán)空間使用分析與清理的方法

    Docker磁盤(pán)空間使用分析與清理的方法

    本篇文章主要介紹了Docker磁盤(pán)空間使用分析與清理的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-03-03
  • centos搭建部署docker環(huán)境的詳細(xì)步驟

    centos搭建部署docker環(huán)境的詳細(xì)步驟

    Docker 將程序與程序的運(yùn)行環(huán)境打包在一起,從而避免了復(fù)雜的環(huán)境配置,下面這篇文章主要給大家介紹了關(guān)于centos搭建部署docker環(huán)境的詳細(xì)步驟,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-07-07
  • 利用Docker搭建Nexus私有倉(cāng)庫(kù)實(shí)現(xiàn)Maven私服

    利用Docker搭建Nexus私有倉(cāng)庫(kù)實(shí)現(xiàn)Maven私服

    Maven大家應(yīng)該都比較熟了,我這里就用安卓人狂喜的Gradle來(lái)演示一下,在build.gradle中編寫(xiě)腳本即可上傳,接下來(lái)通過(guò)本文給大家介紹下利用Docker搭建Nexus私有倉(cāng)庫(kù)實(shí)現(xiàn)Maven私服的問(wèn)題,感興趣的朋友一起看看吧
    2022-01-01
  • 解析docker妙用SpringBoot構(gòu)建微服務(wù)實(shí)戰(zhàn)記錄

    解析docker妙用SpringBoot構(gòu)建微服務(wù)實(shí)戰(zhàn)記錄

    Spring Boot 是 Spring 開(kāi)源組織的子項(xiàng)目,是 Spring 組件一站式解決方案,本文通過(guò)詳細(xì)案例給大家解析docker妙用SpringBoot構(gòu)建微服務(wù)實(shí)戰(zhàn)記錄,感興趣的朋友跟隨小編一起看看吧
    2021-11-11
  • Linux系統(tǒng)安裝docker并用ssh登錄docker容器的操作方法

    Linux系統(tǒng)安裝docker并用ssh登錄docker容器的操作方法

    今天小編就為大家分享一篇Linux系統(tǒng)安裝docker并用ssh登錄docker容器的操作方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-06-06
  • Docker多容器連接(以Tomcat+Mysql為例)

    Docker多容器連接(以Tomcat+Mysql為例)

    這篇文章主要介紹了Docker多容器連接(以Tomcat+Mysql為例),Docker提供了多個(gè)容器直接訪問(wèn)的方法,可以使多個(gè)容器直接通過(guò)網(wǎng)絡(luò)端口進(jìn)行訪問(wèn)
    2017-03-03
  • docker image刪不掉的解決辦法

    docker image刪不掉的解決辦法

    在使用Docker的時(shí)候遇到刪不掉image的情況,怎么回事,如何解決呢?下面小編給大家分享下docker image刪不掉的解決辦法,需要的朋友參考下吧
    2017-01-01
  • 基于Docker搭建iServer集群

    基于Docker搭建iServer集群

    Docker擴(kuò)展了LXC,提供了更高級(jí)別的API,并簡(jiǎn)化了應(yīng)用的打包和部署,為終端用戶創(chuàng)建彼此獨(dú)立的私有環(huán)境,可有效節(jié)約開(kāi)發(fā)者和系統(tǒng)管理員的環(huán)境部署時(shí)間。這篇文章主要介紹了基于Docker搭建iServer集群,需要的朋友可以參考下
    2022-04-04
  • docker-entrypoint.sh文件的用處詳解

    docker-entrypoint.sh文件的用處詳解

    這篇文章主要介紹了docker-entrypoint.sh文件的用處,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • docker-compose中啟動(dòng)鏡像失敗的幾種解決方法

    docker-compose中啟動(dòng)鏡像失敗的幾種解決方法

    本文主要介紹了docker-compose中啟動(dòng)鏡像失敗的幾種解決方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-07-07

最新評(píng)論